Re: wxPython, handling close events
"Matt S." <[email protected]>
| Newsgroups | gmane.comp.python.windows-ce |
|---|---|
| Message-ID | <[email protected]> |
Luke, I'll have to chew on this a bit more. Yesterday afternoon I also discovered (maybe rediscovered) the wxPython port notes for CE at, http://wxwidgets.org/manuals/2.6.3/wx_wxmswport.html#wxmswport The notes and your comments should make my life easier. Thanks hombre, Matt On 2/23/07, Luke Dunstan <[email protected]> wrote: > > As with any Pocket PC application (written in Python or otherwise), the X > "close" button merely hides a window and does not destroy it. The Pocket PC > platform is intended so that users don't need to "close" applications as > such, and if you open enough other applications that the memory starts to > become full, the OS will actually close (WM_CLOSE) some of the applications > that were hidden in the background. If you try clicking the X button on > any of the Microsoft's Pocket PC applications, e.g. Pocket Word, and then > look in the task manager you will notice that it is still running. > > You may be able to capture the event as WM_SHOWWINDOW. > > As with any Python program on the PC, your script is not a process but is > just a text file that is interpreted by the python.exe process. > > Luke > > > ----- Original Message ----- > *From:* Matt S. <[email protected]> > *To:* [email protected] > *Sent:* Thursday, February 22, 2007 2:12 PM > *Subject:* [PythonCE] wxPython, handling close events > > I have a a wxPython application on the PPC 2003, Python 2.4, etc... > > I can gracefully exit on win32 from the frame close button or any button > within the frame. My trouble arises on the PPC because the frame widgets > (esp. close button) seem to not be associated with wx as much as the system > and don't clean up properly. When I tap the close circle-X, the top level > window goes away but the Python CE window remains. Then if I want to > delete/replace the program my request gets refused because the original file > is in use. Furthermore, if I start up the file again it will run but after > loading up, the top level window is the old tlw. > > I've been experimenting with binding close events to a pre-exit function. > I want to either kick up a message dialog to make sure the user wants to > exit or just veto (event.Veto()) the frame level close button event. > > self.top_window.Bind(wx.EVT_CLOSE, self.PreExit) > > I've also fooled around with the following at the application level, > > self.Bind(wx.EVT_QUERY_END_SESSION, self.OnExit) > self.Bind(wx.EVT_END_SESSION , self.OnExit) > > I'm afraid the frame close button event I'm trying to handle is some sort > of hybrid. > > I won't describe it here but I also have a few other issues: > 1) when the PPC goes into sleep mode bad things happen to my app > 2) I've tried to use PocketConsole and the kill utility to find a > resulting hung python program file but I don't see the file as a process. > Python.exe gets listed as a process but I'm not sure I've successfully > ended it. I assume that if I do, the hung python program will get cleaned > up. > 3) Basic PPC os questions: > -If a python file that is being interpreted is not a process, what is it? > -Anyone know how to clean up one of the files when it's not ended > properly? > > If no one has a quick comment that breaks the dam, tomorrow I'll put > together a simple example of my problem and post it for interrogation. > > Thanks! > Matt > > Lastly, please let me know if you think this subject should be posted to a > wxPython list (and which one). Maybe a wxPythonCE list would be helpful in > the near future? > > _______________________________________________ PythonCE mailing list [email protected] http://mail.python.org/mailman/listinfo/pythonce