Very clever! Thanks!
Mick O'Donnell wrote:
>
> Much simpler, and closer to the original posters intention.
> Replace your up_and_down function with:
>
> def up_and_down(*buttons):
>
> for i in range(len(buttons)-1):
> buttons[i].bind("", lambda e, x=buttons[i+1]: x.focus_set())
>
> f
Thus spoketh "Michael O'Donnell"
unto us on Tue, 19 Oct 2010 21:43:57 +0200:
> Much simpler, and closer to the original posters intention.
> Replace your up_and_down function with:
>
> def up_and_down(*buttons):
>
> for i in range(len(buttons)-1):
> buttons[i].bind("", lambda e, x=button
Much simpler, and closer to the original posters intention.
Replace your up_and_down function with:
def up_and_down(*buttons):
for i in range(len(buttons)-1):
buttons[i].bind("", lambda e, x=buttons[i+1]: x.focus_set())
for i in range(1, len(buttons)):
buttons[i].bind("", lambda e, x
Thank you guys! I know what's wrong now! :)
Michael Lange wrote:
>
> Hi,
>
> Thus spoketh Firat Ozgul
> unto us on Tue, 19 Oct 2010 13:19:03 +0300:
>
>> Hello,
>>
>> for loop doesn't work, because in a for loop all events will be bound
>> all at once, and you will only see the effect of t
Hi,
Thus spoketh Firat Ozgul
unto us on Tue, 19 Oct 2010 13:19:03 +0300:
> Hello,
>
> for loop doesn't work, because in a for loop all events will be bound
> all at once, and you will only see the effect of the last binding. You
> need something that binds events one by one.
>
> If I were you
Hello,
for loop doesn't work, because in a for loop all events will be bound all at
once, and you will only see the effect of the last binding. You need
something that binds events one by one.
If I were you, I would use the next() method of Python iterators:
http://paste-it.net/public/pe0b871/
Hi everyone,
I've been writing a long GUI in Python using Tkinter. One thing that I don't
understand is why I can't bind events to widgets in a loop. In the code
below, binding works well if I do it manually (commented out code) but not
in a for loop. Am I doing something wrong?
http://old.nabbl