apostrophe not considered with tkinter's wordstart and wordend
rantingrickjohnson at gmail.com
Mon Jan 5 01:33:35 CET 2015
On Saturday, January 3, 2015 2:28:18 PM UTC-6, ravas wrote:
> Is it possible that this could be added in an upcoming
> version of Python -- or is this a Tk issue?
A quick look at the Tkinter.Text.get source code will answer
that question for you:
py> import inspect
py> from Tkinter import Text
py> print inspect.getsource(Text.get)
def get(self, index1, index2=None):
"""Return the text from INDEX1 to INDEX2 (not included)."""
return self.tk.call(self._w, 'get', index1, index2)
As you can see, this method is just a dumb wrapper. There is
no "python-side" processing going on here. Which is true for
just about the entire Tkinter module.
I'm not sure if you can edit the pre-defined "word capture
patterns" that exist within TK (never had the need to find
out), but you could implement any pattern matching you want
by binding the correct events and then processing the
"target string" on the Python side.
However, i would say that not allowing customization of
patterns is a major flaw of the API, and one more reason why
Tkinter is a rusty old "Clostridium tetani infected" anchor
around Python's neck!
FOR GUIDO'S SAKE, BE SURE YOUR IMMUNIZATIONS ARE UP TO DATE!
More information about the Python-list