Re: Mixing PythonCard and wxPython windows

Kevin Altis <[email protected]> Fri, 26 Dec 2008 15:15:19 -0800
Newsgroups gmane.comp.python.pythoncard
Message-ID <[email protected]>
On Dec 24, 2008, at 3:05 AM, Neil Hughes wrote:

> Has anybody done this?
>
> I have a PythonCard application that currently launches a second
> application, which is a wxPython executable. Both get compiled with
> py2exe and this works fine, except running the wxPython application is
> pretty slow, expecially over a network. This appears to be down to the
> time taken for the second Python and wxPython runtime DLLs to load and
> run.
>
> So...I am resigned to merging the code and making the
> wxPython application a child window (maybe modal, maybe not). My first
> task appears to be getting rid of the wx.App instance in the wxPython
> code, but is there anything else I need to be aware of? Has anybody
> done this before and compiled a list of things to watch out for?
>
> Thanks
> --  
> Neil Hughes

PythonCard is just wxPython underneath, so yeah I would just do your  
wxPython windows as child windows. The single wx.App as you  
discovered is the big limitation and since PythonCard wouldn't work  
without having all the setup from the initialization loop you must  
let your PythonCard app be the initial control.

One other possibility would be to keep one or both of the apps always  
running and communicate as a client/server or some other networking  
via threads, Twisted, etc.

In general, the initial loading of the wxPython runtime is slow the  
first time, but once it has been done, subsequent loads can be pretty  
fast as long as the application is still in the cache. You would have  
to experiment to see if you're limited by memory or if this is just a  
problem with a py2exe build; the executables will be different for a  
"compiled" py2exe application than when you're running wxPython out  
of the site-packages library of Python.

ka


------------------------------------------------------------------------------