<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3059" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>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. </FONT><FONT face=Arial 
size=2>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.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>You may be able to capture the event as 
WM_SHOWWINDOW.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>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.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Luke</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=sleepingbull@gmail.com href="mailto:sleepingbull@gmail.com">Matt 
  S.</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=pythonce@python.org 
  href="mailto:pythonce@python.org">pythonce@python.org</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, February 22, 2007 2:12 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> [PythonCE] wxPython, handling 
  close events</DIV>
  <DIV><BR></DIV>I have a a wxPython application on the PPC 2003, Python 2.4, 
  etc...<BR><BR>I can gracefully exit on win32 from the frame close button or 
  any button within the frame.&nbsp; 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.&nbsp; When I tap the close circle-X, 
  the top level window goes away but the Python CE window remains.&nbsp; Then if 
  I want to delete/replace the program my request gets refused because the 
  original file is in use.&nbsp; Furthermore, if I start up the file again it 
  will run but after loading up, the top level window is the old tlw. 
  <BR><BR>I've been experimenting with binding close events to a pre-exit 
  function.&nbsp; 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. <BR><BR>self.top_window.Bind(wx.EVT_CLOSE, self.PreExit)<BR><BR>I've 
  also fooled around with the following at the application 
  level,<BR><BR>self.Bind(wx.EVT_QUERY_END_SESSION, 
  self.OnExit)<BR>self.Bind(wx.EVT_END_SESSION , self.OnExit)<BR><BR>I'm afraid 
  the frame close button event I'm trying to handle is some sort of 
  hybrid.<BR><BR>I won't describe it here but I also have a few other 
  issues:<BR>1) when the PPC goes into sleep mode bad things happen to my app 
  <BR>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.&nbsp; Python.exe gets listed as a process but I'm not sure I've 
  successfully ended it.&nbsp; I assume that if I do, the hung python program 
  will get cleaned up. <BR>3) Basic PPC os questions:<BR>-If a python file that 
  is being interpreted is not a process, what is it?<BR>-Anyone know how to 
  clean up one of the files when it's not ended properly?<BR><BR>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.<BR><BR>Thanks! 
  <BR>Matt<BR><BR>Lastly, please let me know if you think this subject should be 
  posted to a wxPython list (and which one).&nbsp; Maybe a wxPythonCE list would 
  be helpful in the near future?<BR></BLOCKQUOTE></BODY></HTML>