Tkinter Tab orders and keybindings

Matt Gushee mgushee at havenrock.com
Mon Jan 17 15:49:20 EST 2000


Hi, Tim--

Timothy Grant <tjg at avalongroup.net> writes:

> How does one control the tab order of Tkwidgets? Is it even possible?

AFAIK the only 'built-in' way to do this is by controlling the order
in which you *create* the widgets -- which, of course, is not
necessarily related to their positions on screen.

If that doesn't work for you, you might have to write your own 'next'
and 'prev' methods, which would use your own list of widgets. If you
don't need the Tab key for anything else, you could use the following
bindings in your toplevel window.

self.bind_all('<Tab>', self.next)
self.bind_all('<ISO-Left-Tab>', self.prev)

> also, if I bind the Tab key to a widget, how do I get it to perform its
> original function as well as my function?

Here, again, I think you would need your own traversal method. Then,
of course, you either include some additional actions in the traversal 
method, or bind <Tab> to a handler that invokes the traversal method + 
something else.

Hope this helps.

-- 
Matt Gushee
Portland, Maine, USA
mgushee at havenrock.com
http://www.havenrock.com/



More information about the Python-list mailing list