GreenAsJade
GreenAsJade

Reputation: 14685

Why won't wxpython let me run the wx app in a thread?

I have this:

def AppThread():
    app = wx.App(False)

    frame = M3GUI()
    frame.Show()

    app.MainLoop()


t = threading.Thread(target=AppThread, args=[])
t.start()

print "started"

It actually works fine (with any M3GUI I throw at it - I've tried a range of simple frames etc).

But on closing the wx app (using the window close icon) I get "assert "wIsMainThread()" failed:

this error dialog

Why is this? Can I avoid it?

I am trying to use WX to set up a GUI for another python based app

Upvotes: 0

Views: 134

Answers (1)

Werner
Werner

Reputation: 2096

There are a few pages on the wiki, I think the following is explaining what you need to do:

http://wiki.wxpython.org/MainLoopAsThread

Upvotes: 2

Related Questions