I am running Python 2.5.1 on Windows Vista and i have a problem with the
"Entry" widget of Tkinter. Take a look at this code:
Expand|Select|Wrap|Line Numbers
- from Tkinter import *
- def fetch():
- q=(e.get())
- print q
- root=Tk()
- f=Frame(root)
- f.pack()
- e=Entry(f,width=26)
- e.pack()
- e.focus()
- e.bind("<Any-KeyPress>",(lambda event: fetch()))
- root.mainloop()
although the first Key-Press is shown in the Entry field , the computer
doesn't assign it to the variable which it is assigned , until a SECOND
Key-Press occurs. The same goes for the second one ( although it appears on the
widget , its not assigned until the THIRD Key-Press occurs ) and so on...
Could anyone tell me if this is normal behaviour (and if so how can i "correct" it,
or my code has some kind of flaw?
Many thanks in advance!!!!