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/

Firat

2010/10/19 thea_t <siato...@yahoo.com>

>
> 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.nabble.com/file/p29995174/events.py events.py
> --
> View this message in context:
> http://old.nabble.com/Can%27t-do-proper-event-binding-in-a-for-loop-tp29995174p29995174.html
> Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.
>
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss@python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to