From: balajee on
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
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