[pygtk] Best pattern for keyboard accelerators in dialog

Richard Taylor rjt-pygtk at thegrindstone.me.uk
Fri Jan 26 17:49:51 WST 2007


I have a Window that has a number of widgets placed in it, including a 
TreeView, a Frame (containing more widgets), buttons etc. 

The Frame contains a table with Labels, CheckButton and Edit widgets.

I would like to provide keyboard accelerators that move the focus to the 
appropriate Widget. I want to underline a letter in each label and link 
Alt-<letter> to switch to the Edit widget alongside the Label. I would like 
these accelerators to work regardless of which widget has the focus.

I would really like to keep the handling of these accelerators inside the 
abstractions of the sub-widgets. The Frame is implemented as a subclass of 
gtkFrame and I want to be able to plug in different Frames into the main 
Window with different keybindings. 

Is there a good pattern for coding this type of thing or an example of another 
app that I can take a look at?



More information about the pygtk mailing list