[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: Enter Enter... troubles
From: Sorin Schwimmer <sxn02 () yahoo ! com>
Date: 2007-02-15 6:20:09
Message-ID: 500853.58412.qm () web56004 ! mail ! re3 ! yahoo ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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.
[Attachment #5 (text/html)]
Hi All,<br> <br> In my application I have a class like this:<br> <br> from \
Tkinter import *<br> <br> class MyClass:<br> def __init__(self, root):<br> \
self.property=value<br> \
self.aButton=Button(root, text='Press me!')<br> \
self.aButton.bind('<Return>', self.handler)<br> \
self.aButton.bind('<KP_Enter>',self.handler)<br> ...<br> \
<br> def handler(self,event):<br> \
self.aButton.unbind('<Return>')<br> \
self.aButton.unbind('<KP_Enter>')<br> ...<br> \
localVar=self.property<br> \
self.property=newCalculatedValue<br> ...<br> \
self.aButton.bind('<Return>', self.handler)<br> \
self.aButton.bind('<KP_Enter>',self.handler)<br> <br> The idea is to prevent \
a fast user (like my boss) to press repeatedly the "enter"<br> key and create havoc \
with self.property and localVar. But it doesn't work: my<br> boss manages to start \
at least twice the handler (which, among other things<br> creates a Toplevel, so I \
end up with a messy screen).<br> <br> How should I proceed?<br> <br> Thanks for \
your advices,<br> Sorin<br> <br> <p> 
<hr size=1><a href="
http://us.rd.yahoo.com/evt=49981/*http://advision.webevents.yahoo.com/mailbeta/features_spam.html">Sucker-punch \
spam</a> with award-winning protection.<br> Try the <a href=" \
http://us.rd.yahoo.com/evt=49981/*http://advision.webevents.yahoo.com/mailbeta/features_spam.html">free \
Yahoo! Mail Beta.</a>
--
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic