Re: Gnome "Quit" menu is like clicking a button in a wxPython modal dialog

Dietmar Schwertberger <[email protected]> Sun, 13 Dec 2020 17:05:01 +0100
Newsgroups gmane.comp.python.wxpython
Message-ID <[email protected]>
On 13.12.2020 16:47, Matthias Brennwald wrote:
> Ok, I can see how this works in your example. However, in my 
> application the EVT_CLOSE does not make it the corresponding event 
> handler for some reason. Any clues how / where to check this?

A working minimal code sample is always a good idea. Your previous 
sample was too minimal.
There's no point in having an artificial situation which is not related 
to the original problem any more (e.g. no frame).


> I don't quite get how this would work. Where and how would I add a delay?

dlg_result = dlg.ShowModal()
wx.CallAfter(100, self.delayed_handler, dlg_result)

> I want the "Quit" menu to do NOTHING with a modal dialog, or with a 
> MessageBox. In particular, the "Quit" menu should not close a modal 
> dialog or a MessageBox.

Try to handle the EVT_BUTTON of the Cancel button (without calling 
event.Skip()).
If that does work, you may use a different ID for self.SetEscapeId and 
your own Cancel button.

Also, check whether you can handle EVT_CLOSE of the dialog.

If that doesn't work, you can probably only veto the EVT_CLOSE of the 
frame and then re-open your dialog again.




-- 
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/fc8c37a6-e9fd-0b5d-780c-d540bf36aae4%40schwertberger.de.