self-closing window with wxPython
ian.g.kelly at gmail.com
Fri Sep 17 23:15:04 CEST 2010
On Fri, Sep 17, 2010 at 3:00 PM, Jabba Laci <jabba.laci at gmail.com> wrote:
> > 2) I saw this in the documentation for Destroy() -- "Frames and dialogs
> are not destroyed immediately when this function is called -- they are added
> to a list of windows to be deleted on idle time, when all the window's
> events have been processed." That might be consistent with what you're
> seeing. The window you're trying to destroy has no events in its queue. WHen
> you move the mouse over it, the window processes those mouse events and then
> wx realizes, "Hey, this window has processed all of its events, and it's on
> the list of windows to be destroyed. I'd better get rid of it."
> > If you're interested in experimenting, find a non-mouse way to force that
> window to process an event and I'll bet that would have the same effect as
> moving the mouse over it.
> Thanks for the hint, I could solve the problem. After Destroy() I
> added an extra event:
> As you suggested, the extra event triggers the queue processing and
> when it becomes empty the window gets destroyed.
You could also implement the alarm with a wxTimer instance that triggers a
wxTimerEvent, rather than creating a new thread for no good reason.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list