[pygtk] When to Initialize Non-Main Windows?
Markus W. Barth
markus at sismografo.es
Fri May 30 19:10:00 WST 2008
On Friday 30 May 2008 11:53:58 Casey McGinty wrote:
> Hi,
>
> Is there a best coding practice for the best point in the program execution
> to initialize secondary PyGtk windows?
>
> For example, all the background windows can be created during program init,
> but this might slow down the program startup. The other option is to create
> dialogs on first access, however it might introduce some delay in the GUI.
>
> What is the general conscientious on this, if there is any?
I think there is no general best practice. I usually call destroy() on the
dialogs once run() returns
<snippet>
dialog = gtk.Dialog()
...packing widgets...
dialog.show_all()
dialog.add_buttons(gtk.STOCK_OK,gtk.RESPONSE_ACCEPT,
gtk.STOCK_CANCEL,
gtk.RESPONSE_REJECT)
response_id = dialog.run()
if response_id == gtk.RESPONSE_ACCEPT:
...do what you have to do...
elif response_id == gtk.RESPONSE_REJECT:
... do something else...
else:
... you probably don't need that...
dialog.destroy()
</snippet>
More information about the pygtk
mailing list