NB The absence of an "app.MainLoop()" call at the end, since
> I've called this from ipython, which is supposed to be
> clever and automatically the wxPython main loop in another
> thread automatically (I read this somewhere). I've tried
> running multi-threaded stuff from the regular python shell,
> but without success.
ipython is only clever if you launch it in ipython -pylab for pylab
mode (which is not compatible with MPlot) or if launched in the
--wthread mode for wx threading. So you'll definitely need to do the
latter. I haven't had a lot of experience with --wthread; is it
correct that if you use wthread you should not use the explicit call
to Mainloop?
JDH
Thanks so much for the tip. MPlot seems to be doing real-time plots
for me now, following a) your "-wthread" advice and b)having put the
measurement code in to a seperate thread. Does this seem unnecessarily
complicated? If it works under simpler circumstances, I'll let you know.
Also, the "-wthread" option seems to obviate the call to app.MainLoop().
Thanks again guys!
Marc
Quoting John Hunter <jdhunter@...4...>:
···
> NB The absence of an "app.MainLoop()" call at the end, since
> I've called this from ipython, which is supposed to be
> clever and automatically the wxPython main loop in another
> thread automatically (I read this somewhere). I've tried
> running multi-threaded stuff from the regular python shell,
> but without success.
ipython is only clever if you launch it in ipython -pylab for pylab
mode (which is not compatible with MPlot) or if launched in the
--wthread mode for wx threading. So you'll definitely need to do the
latter. I haven't had a lot of experience with --wthread; is it
correct that if you use wthread you should not use the explicit call
to Mainloop?
JDH
John Hunter wrote:
"Marc" == Marc AHRENS <marca@...990...> writes:
> NB The absence of an "app.MainLoop()" call at the end, since
> I've called this from ipython, which is supposed to be
> clever and automatically the wxPython main loop in another
> thread automatically (I read this somewhere). I've tried
> running multi-threaded stuff from the regular python shell,
> but without success.
ipython is only clever if you launch it in ipython -pylab for pylab
mode (which is not compatible with MPlot) or if launched in the
--wthread mode for wx threading. So you'll definitely need to do the
latter. I haven't had a lot of experience with --wthread; is it
correct that if you use wthread you should not use the explicit call
to Mainloop?
No, in ipython -wthread we hijack Mainloop so that user calls to it actually call a dummy function. So it /should/ be OK for user scripts (as long as -wthread was given, or -pylab with a WX* backend) to call Mainloop. It will just call ipython's dummy replacement.
See
http://projects.scipy.org/ipython/ipython/browser/ipython/trunk/IPython/Shell.py
for details.
Cheers,
f