[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>  &nbsp; def __init__(self, root):<br>  \
&nbsp;&nbsp;&nbsp; self.property=value<br>  &nbsp;&nbsp;&nbsp; \
self.aButton=Button(root, text='Press me!')<br>  &nbsp;&nbsp;&nbsp; \
self.aButton.bind('&lt;Return&gt;', self.handler)<br>  &nbsp;&nbsp;&nbsp; \
self.aButton.bind('&lt;KP_Enter&gt;',self.handler)<br>  &nbsp;&nbsp;&nbsp; ...<br>  \
<br>  &nbsp; def handler(self,event):<br>  &nbsp;&nbsp;&nbsp; \
self.aButton.unbind('&lt;Return&gt;')<br>  &nbsp;&nbsp;&nbsp; \
self.aButton.unbind('&lt;KP_Enter&gt;')<br>  &nbsp;&nbsp;&nbsp; ...<br>  \
&nbsp;&nbsp;&nbsp; localVar=self.property<br>  &nbsp;&nbsp;&nbsp; \
self.property=newCalculatedValue<br>  &nbsp;&nbsp;&nbsp; ...<br>  &nbsp;&nbsp;&nbsp; \
self.aButton.bind('&lt;Return&gt;', self.handler)<br>    &nbsp;&nbsp;&nbsp; \
self.aButton.bind('&lt;KP_Enter&gt;',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>&#32;

<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