There are two reasons why I don't want to use an interpreter in a wxPython
window. First, I like using python from emacs and am very happy with
the emacs interface to python. Second, I plan to do lots of things from
the interpreter, and wxPython is only one of them, so just from a design
point of view it doesn't seem desirable to have wxPython controlling the
interpreter instead of the other way around.
...
So what I'd like to know is... is this possible? Did I misunderstand
Robin's
suggestion, in that what I want is already available? If it isn't, can
anyone give me some pointers on how I might do it myself?
You really need to let the MainLoop run, as there are a number of things in
wxWin that are handled there. (Sending idle events, events from other
threads, cleanup of closed wxFrame objects, etc.) However there are a few
ways you may be able to work around this.
Take a look at demoMainLoop.py in the wxPython demo directory. This shows
how to implement your own MainLoop. You may be able to integrate this with
your own InteractiveInterpreter and get what you are after.
(InteractiveInterpreter is in code.py in the Python library and comes real
close to simulating the real interactive interpreter.)
Another possibility is to run the GUI in an alternate thread. In this case
however you won't be able to call gui methods directly from the interactive
interpreter thread but you'll need some way to send requests over to the gui
thread and execute them there. Perhaps some kind of proxy classes.
Speaking of proxy classes, you could run the gui in a separate process and
use something like XML-RPC to invoke methods of the gui objects. See
rpxMixin.py in the wxPython library for some ideas.
ยทยทยท
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!