How to change deafult tab traversing (radiobuttons & panel)
mnations at gmail.com
Tue Jun 7 00:57:27 CEST 2005
I just figured this out myself, but probably not the way you're asking.
There are supposed to be ways to change the tab order using
tk_focusNext() and tk_focusPrevious(), but I've never used it.
What I've done is simply point one widget to the next one, basically
creating a linked list of tabs. I only had a couple that I wanted to
change the order of, so this was pretty easy to change.
I bound the widgets I wanted changed to <tab> and had a function that
knew where to go. Here's a simple example:
def tab(self, event):
The return 'break' is very important, because if you don't include it
then the default tab functionality of window will be used which will
override whatever changes you make.
I had problems using the tk_focusNext() and tk_focusPrevious() commands
because the two widgets that were supposed to be next to each other in
order were in different windows. I kept getting errors when I tried it.
And since I only had two widgets I created two different functions to
handle the tabs. But if I had more than two I would have created a
forwarding table based on widget names or ids using the event that is
returned in the callback from the binding. Based on the event id
returned I would know where to set focuse next.
More information about the Python-list