[wxPython-users] XRC and subclassing ... prevents app from
closing?
Werner F. Bruhin
werner.bruhin at free.fr
Mon Mar 12 07:40:51 PDT 2007
Paul,
Paul Melis wrote:
> Robin Dunn wrote:
> ...
>>
>> By default the MainLoop function won't terminate while there are any
>> top-level windows in existence. So I expect that you are creating an
>> instance of the dialog, even when you are not using it, so it still
>> exists after the main frame closes, and so the MainLoop doesn't exit.
>> Try instead to delay creating the dialog until you actually need it.
>
> Would destroying the instance with Destroy overcome this problem? Say
> in the File -> Quit handler? I kind of like the idea of creating
> dialogs at startup and cleaning them up at program quit. I makes the
> other code a little easier as I can assume the dialog is always
> available.
I have certain dialogs (which take long to create) which I create on
first use and don't destroy until the app closes. In my app Frame's
close handler I just destroy all these dialogs (using try: as I don't
know if they exist).
I don't use XRC, but I would guess this would work anyhow.
Werner
More information about the wxpython-users
mailing list