Hmmm, clumsy subject line but here's my situation:
A commercial application that we use (Abaqus/CAE, fwiw) has an embedded
Python interpreter. It allows access to the interpreter through a
plugin architecture.
We have developed several applications/classes/widgets in wxPython.
We'd like to call some of these classes from CAE and return data. The
workflow would be to call the class (displaying a wxFrame for example),
have the user interact with the class, and then have the class return
some data to the calling function.
If I do this by just importing the class and trying to display the
frame, the interpreter throws an exception "wx._core.PyNoAppError: The
wx.App object must be created first!".
OK, fair enough. I'm a little leery about creating an instance of
wx.App when it's not the main thread, but I gave it a go. This worked
much better, the frame popped up and I was able to interact with it.
However, when I closed the frame, control didn't return to the embedded
interpreter.
Now I haven't put a lot of time into troubleshooting this, but when I
run the class from the command line, it behaves: pops up the frame,
interaction happens, and on closing the frame it exits nicely back to
the command line.
So my question is, am I taking the right tack here? Should I be
instancing a new wx.App every time I want to display a dialog and then
make sure it cleans up nicely when it closes? Or is there some other
approach I can take here? I looked at Robin's PIA book, and I've looked
through some of the stuff in the documents & demos, but nothing quite
matches what I think I'm looking for.
Anyone have some insight?
Thanks,
Anthony.
···
--
Anthony Floyd, PhD
Convergent Manufacturing Technologies Inc.
6190 Agronomy Rd, Suite 403
Vancouver BC V6T 1Z3
CANADA
Email: Anthony.Floyd@convergent.ca | Tel: 604-822-9682
WWW: http://www.convergent.ca | Fax: 604-822-9659
CMT is hiring: See http://www.convergent.ca for details