[PythonCE] wxPython, handling close events

Matt S. sleepingbull at gmail.com
Thu Feb 22 06:12:08 CET 2007


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.exegets 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?

On 2/21/07, pythonce-request at python.org <pythonce-request at python.org> wrote:
>
> Send PythonCE mailing list submissions to
>        pythonce at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://mail.python.org/mailman/listinfo/pythonce
> or, via email, send a message with subject or body 'help' to
>        pythonce-request at python.org
>
> You can reach the person managing the list at
>        pythonce-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of PythonCE digest..."
>
> Today's Topics:
>
>   1.  Bluetooth (ricercar at infinito.it)
>   2. Re: Bluetooth (Ruben M. G.)
>   3.  serial port access (adrian wong)
>   4. Re: serial port access (adrian)
>
>
> ---------- Forwarded message ----------
> From: ricercar at infinito.it
> To: pythonce at python.org
> Date: Tue, 20 Feb 2007 12:54:18 +0100
> Subject: [PythonCE] Bluetooth
> Hi all,
> I sent this email by mistake directly to Ruben, my apologize to him and
> all. In the meantime Ruben answered other emails and I did some further
> steps, so thinks are clearer to me.
>
> I read with interest your posts about bluetooth. I also started looking
> into it, but started form another point: using ctypes to call directly the
> windows mobile dlls. Since I had not much time the first tries were
> unsuccessful, I will retry during the next weekend. But this process
> involve a lot of typing to convert classes and constants!
> I think also your idea of creating a dll could be interisting. Can you
> tell
> me which development tools are you using?
> I programmed in C++ for over ten years but now they are more or less four
> years that I work with other languages, so at the moment I have only the
> tools I need to build Python extensions. I don't know exactly what I need
> to build for the windows mobile.
>
> Regards,
> Enrico Bortolazzi
>
>
>
>
> ---------- Forwarded message ----------
> From: "Ruben M. G." <xrubenx.es at gmail.com>
> To: pythonce at python.org, "ricercar at infinito.it" <ricercar at infinito.it>
> Date: Tue, 20 Feb 2007 12:41:04 +0000
> Subject: Re: [PythonCE] Bluetooth
>  Dear Enrico Bortolazzi,
>
> > I read with interest your posts about bluetooth. I also started looking
> > into it, but started form another point: using ctypes to call directly
> the
> > windows mobile dlls.
>
>         That was my last idea before start to use ceserial.py
>         But I didn't feel with time enough to learn to use ctypes and the
> dll so I
> took another road (ceserial).
>
> > Since I had not much time the first tries were
> > unsuccessful, I will retry during the next weekend. But this process
> > involve a lot of typing to convert classes and constants!
> > I think also your idea of creating a dll could be interisting. Can you
> tell
> > me which development tools are you using?
>
>         Of course.
>
> You have to install  "eMbedded Visual C++ 4.0" and then "SDK for Windows
> Mobile 2003-based Pocket PCs".
>
> You need these two applications if you want to write an application on C++
> for
> Windows Mobile. Or at least is what they say on the web :P
>
> http://www.microsoft.com/downloads/details.aspx?FamilyID=9996b314-0364-4623-9ede-0b5fbb133652&DisplayLang=en#Requirements
>
> http://msdn2.microsoft.com/en-us/embedded/aa714533.aspx
>
>         You could try to compile as a dll what I called "the Bluetooth
> stack core for
> Windows CE" and then use it with ctypes. (I have no idea how to do it).
>
>         Have fun amico!!
>
> --
>  Kind regards / Cumprimentos / Atentamente, Ruben.
>
>
> ---------- Forwarded message ----------
> From: "adrian wong" <awong8888 at gmail.com>
> To: pythonce at python.org
> Date: Tue, 20 Feb 2007 17:46:28 -0800
> Subject: [PythonCE] serial port access
> Hello
>
> I would like to access my serial port on my pocket pc. Would someone
> sent me the ceserial.py codes and give me a few pointers on "how to"
> do a "Hello World " type python program to strart. I'm very new to
> python and very, very very new to pythonce. I tried this link
> "http://mail.python.org/pipermail/pythonce
> /attachments/20060922/5af92a01/attachment-0003.py
> ", but when I import ceserial, pythonce gave me a "SyntasError:
> invalid synax"
> Thanks in advance.
> Adrian
> awong8888 at gmail.comhttp://mail.python.org/pipermail/pythonce
> /attachments/20060922/5af92a01/attachment-0003.py
> ", but when I import ceserial, pythonce gave me a "SyntasError:
> invalid synax"
> Thanks in advance.
> Adrian
> awong8888 at gmail.com
>
>
>
> ---------- Forwarded message ----------
> From: adrian <awong8888 at gmail.com>
> To: pythonce at python.org
> Date: Wed, 21 Feb 2007 07:42:20 +0000 (UTC)
> Subject: Re: [PythonCE] serial port access
> adrian wong <awong8888 <at> gmail.com> writes:
>
> >
> > Hello
> >
> > I would like to access my serial port on my pocket pc. Would someone
> > sent me the ceserial.py codes and give me a few pointers on "how to"
> > do a "Hello World " type python program to strart. I'm very new to
> > python and very, very very new to pythonce. I tried this link
> >
> "http://mail.python.org/pipermail/pythonce
> /attachments/20060922/5af92a01/attachment-0003.py
> > ", but when I import ceserial, pythonce gave me a "SyntasError:
> > invalid synax"
> > Thanks in advance.
> > Adrian
> > awong8888 <at>
> gmail.comhttp://mail.python.org/pipermail/pythonce
> /attachments/20060922/5af92a01/attachment-0003.py
> > ", but when I import ceserial, pythonce gave me a "SyntasError:
> > invalid synax"
> > Thanks in advance.
> > Adrian
> > awong8888 <at> gmail.com
> >
>
>
> when I click on the link in my own post, I downloaded the file instead of
> cut
> and pasted the text. And it is working, or at least I imported without any
> error.
> in case someone else want to do this, you also need windase.py a link
> http://mail.python.org/pipermail/pythonce
> /attachments/20060922/5af92a01/attachment-0002.py
>
> the code is from Benjamin McBride in a post earlier.
>
>
> Adrian
>
>
>
> --===============2007223627==--
> _______________________________________________
> PythonCE mailing list
> PythonCE at python.org
> http://mail.python.org/mailman/listinfo/pythonce
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonce/attachments/20070221/a9000b30/attachment.html 


More information about the PythonCE mailing list