Hello
Please can anyone help me?
In the following test script I am creating windows which are transient and modal. If I destroy the last window and try to grab_focus on a widget on the next window it does not happen. I am obviously missing something! Some help would be appreciated.
import pygtk pygtk.require("2.0") import gtk
class Test:
def __init__(self):
# Window One
w1 = MkWin()
w1.win.show_all()
top = w1.win.get_toplevel() # Window Two with entry
w2 = MkWin(trans=top)
self.e2 = gtk.Entry()
w2.win.add(self.e2)
self.e2.set_flags(gtk.CAN_FOCUS)
w2.win.show_all() # Window Three with entry
self.w3 = MkWin(trans=top)
e3 = gtk.Entry()
self.w3.win.add(e3)
e3.connect("activate", self.doTest)
e3.set_flags(gtk.CAN_FOCUS)
# Focus on entry
e3.grab_focus()
self.w3.win.show_all()gtk.main()
def doTest(self, wid):
self.w3.win.destroy() # Focus on entry ???
self.e2.grab_focus()class MkWin:
def __init__(self, trans=None):
self.win = gtk.Window(type=gtk.WINDOW_TOPLEVEL)
self.win.connect('destroy', self.doDestroy)
self.win.connect('delete_event', self.doDestroy)
if trans:
self.win.set_transient_for(trans)
self.win.set_decorated(False)
self.win.set_modal(True) def doDestroy(self, wid=None, data=None):
wid.destroy()if __name__ == "__main__": tt = Test()
_______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
