[pygtk] Focus issue with change of notebook page
Neil Dugan
pygtk at butterflystitches.com.au
Thu Dec 20 13:49:41 WST 2007
Gary Jaffe wrote:
> Hi all --
>
> I have several pygtk apps that each run in its own page of a notebook.
> The user can load up and run the apps as he/she wishes.
>
> I would like to have the widget that has the focus for each page to
> still have the focus when the user clicks another notebook tab and then
> comes back to the original page. But what happens is that when the user
> changes to a new page by clicking on the tab, the focus is set to the
> first widget that can focus. If my program switches to the new page,
> this doesn't happen.
>
> I've even tried storing which widget that has the focus on each page and
> explicitly doing a grab_focus to that widget when I get a switch-page
> event. I still get the focus set to the first widget that can focus. I
> even checked to make sure I have the right widget just before doing the
> grab.focus. I also tried returning True from the method that handles
> the switch-page evnet and connecting with connect_after rather than
> connect. Nothing has done any good. :(
>
> Does anyone know how to do this?
>
Haven't tried this exactly, but have you tried putting the
grab_focus() call after a small timeout delay ?
gobject.timeout_add(500,widget.grab_focus)
More information about the pygtk
mailing list