[python-win32] Skip Alt+F4 (le dahut)
mdriscoll at co.marshall.ia.us
Tue Mar 18 14:30:11 CET 2008
> Date: Mon, 17 Mar 2008 14:11:14 +0100
> From: le dahut <le.dahut at laposte.net>
> Subject: Re: [python-win32] Skip Alt+F4
> To: Paul Moore <p.f.moore at gmail.com>
> Cc: Python-Win32 List <python-win32 at python.org>
> Message-ID: <47DE6DF2.6050108 at laposte.net>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> Oh yes ! That's it. Thank you.
> It is a frame that's used by a service to display some
> information before uncancelable forced reboot.
> I now have to determinate how to modify the informations
> displayed in the frame.
> Should my program run in the class of the frame ? Or should
> it get a sort of handler to the frame and modify the content
> of a text box ?
> I don't know if the second way is possible.
If you created the frame and the TextCtrl in wxPython, then it's pretty
trivial to grab the contents from it and edit it as much as you like.
Something like this will get the info:
text = myTextCtrl.GetValue()
Now it's up to you what you want to do with it. You can use the SetValue()
method to change it to something else. If you're using StaticText
controls, the methods would be GetLabel() and SetLabel() respectively. All
of this is in the wx docs:
And why are you posting wx questions to the pywin32 list anyway?
> Paul Moore a ?crit :
> > On 17/03/2008, le dahut <le.dahut at laposte.net> wrote:
> >> I'm writting a Wx app and I want to skip Alt+F4. I've used
> >> like that :
> >> def OnKeyDown(self, event):
> >> print event.AltDown(), event.GetKeyCode()
> >> if event.AltDown() and event.GetKeyCode() == wx.WXK_F4:
> >> print 'try to close'
> >> Everything gets printed but my app closes anyway on
> Alt+F4, is there
> >> a way to skip this ?
> > (a) you should think hard before doing this - about the only
> > reasonable reason for overriding the standard Alt-F4 on
> Windows, is to
> > minimise to the tray rather than closing
> > (b) if you still want to do this, look at the OnClose
> event, and override that.
> > Paul.
More information about the python-win32