spillz
April 17th, 2010, 10:29 PM
I have an app with a gtk Box in my main window and a modal dialog that I want to display after the box has fully rendered.
I thought of doing something along these lines
class MainBox(gtk.HBox):
def __init__(self):
gtk.HBox.__init__(self)
self.pack_start(widget1)
self.pack_start(widget2)
...
self.show_all()
self.run_dialog()
def run_dialog(self):
d=Dialog()
d.run()
##do stuff with result
class Dialog():
def __init__(self):
#add a bunch of widgets etc
But the problem is the dialog will run before MainBox displays and because the dialog is modal it blocks the display of the mainbox until it is destroyed.
Short of running a timer with callback is there a to guarantee that the MainBox has rendered correctly before the dialog runs? I couldn't see an obvious signal in gtk.Widget, but maybe I'm missing something...
I thought of doing something along these lines
class MainBox(gtk.HBox):
def __init__(self):
gtk.HBox.__init__(self)
self.pack_start(widget1)
self.pack_start(widget2)
...
self.show_all()
self.run_dialog()
def run_dialog(self):
d=Dialog()
d.run()
##do stuff with result
class Dialog():
def __init__(self):
#add a bunch of widgets etc
But the problem is the dialog will run before MainBox displays and because the dialog is modal it blocks the display of the mainbox until it is destroyed.
Short of running a timer with callback is there a to guarantee that the MainBox has rendered correctly before the dialog runs? I couldn't see an obvious signal in gtk.Widget, but maybe I'm missing something...