[Tkinter-discuss] Cursor Index From Tkinter.Text in <KeyRelease> Gives Insconsistent Column, Test Case

Michael Lange klappnase at web.de
Sat Sep 13 17:56:17 CEST 2014


Hi,

On Fri, 12 Sep 2014 05:32:33 +0200
jevan at freenet.de wrote:

(...)
> TEST ONE
> 
>         Type this string slowly: 'one two three'
>         Press F1 to see each word undo.
> 
>     Result: Works fine. (For me atleast. Ephasis: type slowly.)
> 
> TEST TWO
> 
>         Type the same string as fast as you can: 'one two three'
>         Press F1 to see each word undo.
> 
(...)
> from Tkinter import *
> 
> class TextView(Text):
> 
>     def __init__(self, root):
>         Text.__init__(self, root)
> 
>         self.history = History(self)
>         self.bind("<KeyRelease>", self.keyRelease)
> 
>         # used to capture a char at a time in keyRelease.  If space
> char is pressed it , self.word)
> 
> if __name__ == "__main__":
>     root = Tk()
>     root.geometry("400x200+0+0")
> 
>     textView = TextView(root)
>     textView.pack()
>     root.bind("<F1>", textView.undo)
>     root.bind("<F2>", textView.redo)
> 
>     root.mainloop()

Looks like there is something missing here :-)
Could you please post a short but complete code example that exhibits the
problem?

Regards

Michael

.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

Peace was the way.
		-- Kirk, "The City on the Edge of Forever", stardate
                   unknown


More information about the Tkinter-discuss mailing list