bug in Tkinter (FIX)

Ed Blake kitsune_e at yahoo.com
Fri Jan 6 15:52:52 EST 2006


It's my first time posting to the list so I hope I don't sound like an idiot!
 The other day I was looking for a way to keep track of whether a user had
changed the contents of a Tk text widget.  After a little bit of searching I
found edit_modified.  This should let me get/set the modified flag on a Tk
text widget... But using it to check the flag raises an exception.  A little
more searching showed that the problem had been reported numerous times, but
never fixed.  So, despite the fact that I could use Tk.call to access the
value directly, I decided to poke around in Tkinter.py and see if I could fix
it myself.  It took about five seconds to fix the problem ^_^

Search for 'edit', it is a method in the Text class.  Replace:
return self._getints(self.tk.call((self._w, 'edit') + args)) or ()

With:
        if 'modified' in args:
            return self._getboolean(
            self.tk.call((self._w, 'edit') + args)) or ()
        return self._getints(
            self.tk.call((self._w, 'edit') + args)) or ()

Simple right?  Anyway could somebody fix this in the official version please?



More information about the Python-list mailing list