From: balajee on 28 Apr 2010 07:13 Hi, I have a tk text window. My need is - if I highlight some portion of text with mouse, it should automatically be saved into a variable. Please suggest me on how to do this. Thanks, Balajee
From: Arjen Markus on 28 Apr 2010 09:23 On 28 apr, 13:13, balajee <balaj...(a)gmail.com> wrote: > Hi, > I have a tk text window. My need is - if I highlight some portion > of text with mouse, it should automatically be saved into a variable. > Please suggest me on how to do this. > > Thanks, > Balajee You need to set up a binding for the event that ends the selection, something along these lines: ..text configure -exportSelection 1 bind .text <<Selection>> {set selectedText [.text get [.text tag range "sel"]]} (just a sketch, the details won't be right) Regards, Arjen
|
Pages: 1 Prev: Delete spaces Next: canvas, [font measure], and vertical text |