wxpython application ( problem ? )

V

vedrandekovic

Hello,

Here is sample of my simple script with wxpython and modules:
subprocess,threading, directpython.......

Code sample:

import wx
import wx.aui
app=wx.App()
frame=wx.Frame(None,title="New project")

#There is also part with wx.aui

frame.Show()
app.MainLoop()


After a few minutes wx application does destroy. Any ides why?
 
M

Marc 'BlackJack' Rintsch

Here is sample of my simple script with wxpython and modules:
subprocess,threading, directpython.......

Are you accessing the GUI from threads?

Ciao,
Marc 'BlackJack' Rintsch
 
B

Bjoern Schliessmann

yes, so what's the problem?

http://wxwidgets.org/manuals/stable/wx_wxthreadoverview.html
| If you do decide to use threads in your application, it is
| strongly recommended that no more than one thread calls GUI
| functions. The thread sample shows that it is possible for many
| different threads to call GUI functions at once (all the threads
| created in the sample access GUI), but it is a very poor design
| choice for anything except an example. The design which uses one
| GUI thread and several worker threads which communicate with the
| main one using events is much more robust and will undoubtedly
| save you countless problems (example: under Win32 a thread can
| only access GDI objects such as pens, brushes, &c created by
| itself and not by the other threads).

Regards,


Björn
 
K

kyosohma

Hello,

Here is sample of my simple script with wxpython and modules:
subprocess,threading, directpython.......

Code sample:

import wx
import wx.aui
app=wx.App()
frame=wx.Frame(None,title="New project")

#There is also part with wx.aui

frame.Show()
app.MainLoop()

After a few minutes wx application does destroy. Any ides why?

I highly recommend reading this wxPython wiki entry about using
threads in wxPython:

http://wiki.wxpython.org/LongRunningTasks

I've found it quite helpful in my own programming.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,962
Messages
2,570,134
Members
46,692
Latest member
JenniferTi

Latest Threads

Top