FW: Need help with Tkinter bind statement

John Shankland jshaXXXnkland at insXXXpiration.com
Tue Mar 6 16:22:48 EST 2001


I'm not sure about the <-> problem but for the other keys you need to
return "break", to stop Tkinter from going up the bindings chain. A good
doc for this would be
http://www.pythonware.com/library/tkinter/introduction/events-and-bindings
.htm 

--
©¿©¬
John



Mike.mellor at tbe.com (Mellor, Mike) wrote in
<mailman.983910277.5499.python-list at python.org>: 

># Bindings
>xStack.bind('<+>', lambda event, fxn = 'y+x':Calc(fxn))
>xStack.bind('<->', lambda event, fxn = 'y-x':Calc(fxn)) # This is 
>causing an error
>xStack.bind('<*>', lambda event, fxn = 'y*x':Calc(fxn))
>xStack.bind('</>', lambda event, fxn = 'y/x':Calc(fxn))
>
>where xStack is an entry widget and Calc is a function that does the 
>calculation.  
>
-- snip --

>
>but the other bindings work fine.  The second problem is that when I 
>use any of these keys, the keystroke shows up in the entry widget.  
>What I want to happen is that pressing the "+" key, for example, 
>should add the values in the xStack and yStack (which it does) and 
>then put the result in the yStack entry widget (which it also does).  
>The problem is that the "+" is left in the xStack.  The contents of 
>the xStack are deleted by the Calc function, so I thought it would 
>also delete the "+" as well.  
>
>Thanks.
>
>Mike
>
>
>
>
>
>




More information about the Python-list mailing list