[IPython-user] Closing an embedded IPython Shell.

Dennis Muhlestein djmuhlestein@gmail....
Wed Jul 29 12:31:19 CDT 2009


On Jul 29, 2009, at 11:23 AM, Brian Granger wrote:

> Whew, this is much more complicated then.  A few comments:
>
> * Is your GUI running in the main thread?  Most GUI toolkits I know  
> of get very grumpy if they are not run in the main thread.  This  
> alone could cause problems.

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.)

>
> * 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.

>
> * 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.

-Dennis


More information about the IPython-user mailing list