On Wed, 21 Nov 2001, Steve McClure wrote:

> > Sylvain Thenault <[EMAIL PROTECTED]> writes:
> >
> > hello, 
> > 
> > does anybody knows how to give the focus to a particular window using
> > pygtk ? (I wish the designed window to take focus and to come to the
> > foreground if another window hided it).
> > 
> > I'm using gtk+ 1.2.8 and pygtk 0.6.6
> > 
>     def showDialog(self, dialogName, title = None):
>         d = self.wtree.get_widget(dialogName)
>         if title:
>             d.set_title(title)
>         if d.flags(gtk.MAPPED) == 0:
>             d.show()
>         else:
>             d.get_window()._raise()
>             # call map again so dialogs will refresh their contents
>             return d.emit('map', d)
> 
> I don't mess with the focus, probably bad manners even if the window 
> manager lets you do it, but you can probably add 
> 
>             d.grab_focus() to the above code.
 
Thanks a lot, it works perfectly :), except for the focus (d.grab_focus()
at the end of the function doesn't change anything) but the main is done,
I don't really care for the focus if the window came to the foreground...

-- 
Sylvain Thenault

  LOGILAB           http://www.logilab.org


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to