Thus spoketh "Michael O'Donnell" <michael.odonn...@uam.es> 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("<Down>", lambda e, x=buttons[i+1]: x.focus_set()) > > for i in range(1, len(buttons)): > buttons[i].bind("<Up>", lambda e, x=buttons[i-1]: x.focus_set()) > Sure, you're right. Here's another, even simpler, candidate: def up_and_down(*buttons): for b in buttons[:-1]: b.bind('<Down>', lambda event: b.event_generate('<Tab>')) for b in buttons[1:]: b.bind('<Up>', lambda event: b.event_generate('<Shift-Tab>')) Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. I'm frequently appalled by the low regard you Earthmen have for life. -- Spock, "The Galileo Seven", stardate 2822.3 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss