Reputation: 517
I am trying to find the best way to inhibit text selection in a Tk text widget. Here an example of code using Iwidget's ScrolledText:
package require Iwidgets
iwidgets::scrolledtext .t
pack .t
I already tried to bind to <<Selection>>
virtual event without success yet to unbind <Double-1>
event.
Any ideas?
Upvotes: 1
Views: 352
Reputation: 137797
It's moderately awkward to prevent the selection from being created (there are a great many bindings that do things with it) but you can easily prevent it from affecting the rest of the application (by configuring the text widget to have -exportselection false
). Then all you need to do is ensure that it can't be seen by configuring it to be invisible (through the text widget's -selectbackground
and -selectborderwidth
options).
Upvotes: 3