Enter Enter... troubles
Sorin Schwimmer
sxn02 at yahoo.com
Thu Feb 15 01:20:09 EST 2007
Hi All,
In my application I have a class like this:
from Tkinter import *
class MyClass:
def __init__(self, root):
self.property=value
self.aButton=Button(root, text='Press me!')
self.aButton.bind('<Return>', self.handler)
self.aButton.bind('<KP_Enter>',self.handler)
...
def handler(self,event):
self.aButton.unbind('<Return>')
self.aButton.unbind('<KP_Enter>')
...
localVar=self.property
self.property=newCalculatedValue
...
self.aButton.bind('<Return>', self.handler)
self.aButton.bind('<KP_Enter>',self.handler)
The idea is to prevent a fast user (like my boss) to press repeatedly the "enter"
key and create havoc with self.property and localVar. But it doesn't work: my
boss manages to start at least twice the handler (which, among other things
creates a Toplevel, so I end up with a messy screen).
How should I proceed?
Thanks for your advices,
Sorin
---------------------------------
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070214/4cc4bfd0/attachment.html>
More information about the Python-list
mailing list