From: John Hunter [mailto:jdhunter@nitace.bsd.uchicago.edu]
Is there an example somewhere that shows how to create a custom,
threaded, python shell that can be used to control a wx app. Rather
than pycrust, which is a shell in a wx application, I want something
more along the lines of
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109 which
does what I am looking for for GTK, which creates a python shell in a
regular terminal that can be used to control pygtk apps.
Would this work: put the commands entered from the Python shell on a
Queue.Queue, and have a wx idle handler retrieve items from the queue and
eval/exec them? I suppose you would want the handler to have (synchronized)
access to the global dictionary of the shell. AFAIKT, that would be
sufficient to maintain responsiveness of both shell and gui and integrity of
both threads.
I'm not sure though if there is any way of guaranteeing that the main wx
thread couldn't be caught in a loop if you give it such a command
(presumably by mistake), and if so, is it possible to kick it out of it?
Possibly generating a KeyboardInterrupt (though a recent discussion on this
list indicates you might have to override the default wx handling of that
exception).
Oliver