RE: Catching key press events while model wx.MessageDialog(...) is shown?

Steve Barnes <[email protected]> Tue, 1 Jun 2021 06:44:02 +0000
Newsgroups gmane.comp.python.wxpython
Message-ID <VI1PR03MB65757AA919C3CB7E58715D9F9B3E9@VI1PR03MB6575.eurprd03.prod.outlook.com>
If you use a progress dialog rather than modal message dialog then you can check for the stop button on each update and (as it is not modal) the application key bindings will still be in effect so you can simply bind wx.EVT_KEY_DOWN to a function that checks for your secret key press and if the background task is running kills it. I think that you could possibly also bind a key handler to the modal dialog after creation and before showing it - it is definitely worth a test. Alternatively the AGW Generic Dialog can definitely have a key press handler.

Hope that has given you some ideas.

Steve

From: [email protected] <[email protected]> On Behalf Of Matthias Brennwald
Sent: 01 June 2021 06:26
To: [email protected]
Subject: RE: [wxPython-users] Catching key press events while model wx.MessageDialog(...) is shown?


On Tue, Jun 1 2021 at 02:39:57 +0000, Steve Barnes <[email protected]<mailto:[email protected]>> wrote:

Wouldn't a wx.ProgressDialog or a wx.agw.pyprogress be more appropriate than a modal wx.MessageDialog? You can optionally have an abort button (in addition to the "Stop"

I know what you mean. I should have explained a bit better.

The idea is that "normal" users are provided with the "Stop" button only, so that they will not mess with the clean completion of the long running background thread. The additional feature to *immediately* kill the background thread should not be obvious to "normal" users, but should still be there to allow "those who know what they are doing" to kill the process immediately. That's why I don't want to show an "immediate kill" button along with the standard "Stop" button, but rather trigger the "immediate kill" by pressing a (secret) key.

It would be great if anyone has an idea how to implement the key press feature!
--
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]<mailto:[email protected]>.
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/0FC0UQ.P0832EZ53UFD1%40gmail.com<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fwxpython-users%2F0FC0UQ.P0832EZ53UFD1%2540gmail.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=04%7C01%7C%7C73280a0d742f40e9f3f908d924bdbdd3%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637581219608125746%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=aPymOaa4Kqz8gPlRM3DpbDhCoa7nlMAvnptglDWt1%2BE%3D&reserved=0>.

-- 
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/VI1PR03MB65757AA919C3CB7E58715D9F9B3E9%40VI1PR03MB6575.eurprd03.prod.outlook.com.