apostrophe not considered with tkinter's wordstart and wordend
Christian Gollwitzer
auriocus at gmx.de
Thu Jan 22 17:26:15 EST 2015
Am 05.01.15 um 14:20 schrieb Rick Johnson:
> *GASP*! Of course all this could be avoided if those short-
> sighted TK folks would have allowed the programmer to define
> the pattern!
>
> ಠ_ಠ
Well, it turns out you actually can. We don't have Guido's time machine,
but still there is a configuration option in Tk, albeit a very obscure
one: you have to set the global Tcl variables tcl_wordchars and
tcl_nonwordchars after loading Tk to a regexp which defines the word
boundaries:
http://wiki.tcl.tk/1655
Strangely, there is a different preset for Windows and X11. The Windows
preset - consider everything besides space as part of the word - makes
more sense to me than the Unix default, which only counts letters,
numbers and underscores as part of the word. To set the Windows preset,
do this:
tk.eval('set tcl_wordchars {\S}');
tk.eval('set tcl_nonwordchars {\s}');
(untested in Python, only tested directly from a wish shell)
Christian
More information about the Python-list
mailing list