Problems in using wxPython in a multithreaded context

kyosohma at gmail.com kyosohma at gmail.com
Mon Oct 22 15:43:23 CEST 2007


On Oct 22, 4:53 am, mec2pa... at gmail.com wrote:
> For my C application, I use many interpreters (withh the fonction
> Py_NewInterpreter()). For my needs, I create many GUI with wxPython
> and I have problems. Here is My C Code:
>
> {
>     PyEval_InitThreads();
>     Py_Initialize();
>     PyImport_ImportModule("myModule");//it creates a wxApp and a GUI
>     ......
>
>     Py_NewInterpreter();
>     PyImport_ImportModule("anotherModule");//it should create a new
> wxApp and a new GUI
>
> Unfortunately this code does not work. In fact, My C application which
> use many interpreters is seen by wxPython as a single application, and
> as wxPython is thread safe, it is not possible to create a second
> App.
> I have to use many interpreters to separate variables and to avoid
> links between modules.
>
> What could I do to create many GUI in different interpreters (each GUI
> have to be in a separate environment)???
>
> Thanks.

You should probably check out this thread:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/4ac31cd3a389a4d8/

And this might help as well:

http://www.pyzine.com/Issue001/Section_Articles/article_ThreadingGlobalInterpreter.html

And here's a wxPython specific article on threading:

http://wiki.wxpython.org/LongRunningTasks

You might consider posting to the wxPython mailing list too, as they
can probably help you more.

Mike




More information about the Python-list mailing list