[IPython-user] Closing an embedded IPython Shell.

Brian Granger ellisonbg.net@gmail....
Wed Jul 29 12:38:25 CDT 2009


No.  It's wxPython.  wxPython can be run in any thread you want as long as
> communication with the GUI methods occur from the same thread that the main
> loop is running.  We don't use the shell to call GUI methods.  We use the
> shell to call methods on a device to tune performance and settings (the
> device is thead safe.)

OK, this clarifies.  I thought wxPython *has* to be run in the main thread,
but I guess not.

>> * Are you uses IPython's threaded shells to integrate ipython with the
>> GUI?  If not, can you better describe how the two are integrated.
> No.  I specifically don't want -wthread because I don't want calls in the
> shell to block the GUI.  We have other threads doing heavy USB IO in the GUI
> and it needs to run without the commands in the shell blocking it.
> Example, I specifically want to be able to do something like this in the
> shell:
> while True: pass
> Then I want to be able to have the GUI run without being blocked.  When I
> see that my command might not be returning, ctrl-c the command in the shell,
> and have the GUI continue to run as if it didn't know what is going on.  I
> see why many people want commands in the shell run on the GUI thread and I
> know how IPython uses uses the hijacked GUI loops to execute the shell
> commands on the GUI thread but that doesn't suit my needs.

Definitely, you can't use the -wthread options.

* Sometime very soon (like next week) we will be merging some new code into
the ipython trunk that will have a much better way of doing GUI integration
(it doesn't require threads).  While I haven't tested it with embedding, it
should make these things much simpler.  Note:  this new stuff won't be in
the upcoming 0.10 release.

> There may be something that helps but really the only issue I'm having is
> when I close the app, my shell doesn't drop back to the prompt until I press
> Enter.  I don't think it's much related to the GUI thread situation.

The new stuff won't help you at all because the GUI and shell run in the
same thread.

You problem might not be related to the GUI thread, but I do think it might
be related to the GUI/shell interaction.  I say this because the code I sent
you works just fine when there is no GUI around.  Is there any way you can
debug this more to see where the shell is waiting on stdin?

Sorry I can't be of more help.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20090729/33d3740f/attachment.html 

More information about the IPython-user mailing list