[IPython-user] gtk.main_iteration() blocks ipython

Pieter Cristiaan de Groot p.c.degroot@tudelft...
Wed Apr 9 02:48:01 CDT 2008


Thanks Ville for responding,

i've tried what you said and indeed get a different outcome (using 
ipython 0.8.3rc) Now when I run gtk.main_iteration() the gtk window 
hangs (just as before), but  hitting 'enter' in the ipython shell will 
give you (after 4 seconds):

Warning: Timeout for mainloop thread exceeded
switching to nonthreaded mode (until mainloop wakes up again)

At this point the gui is not responding anymore, but the ipython shell 
usable. When I run the gtk.main_iteration() a second time the ipython 
shell blocks (just as before), but the gui is completely usable. Which 
is probably what you expect in non-threaded mode.

It's not clear to me yet if I'm trying something that should not be 
done, or if it is a feature that is being worked on  but does not work 
yet as it should.

If the second is the case, I'll just have to wait (or join fixing it), 
but if the first is the case can somebody maybe tell me how I could make 
the gui responsive while the ipython shell is executing something?

thanks,
Pieter




Ville M. Vainio wrote:
> On Tue, Apr 8, 2008 at 1:12 AM, Pieter Cristiaan de Groot
> <p.c.degroot@tudelft.nl> wrote:
>
>   
>>  executing some loop. What function am I allowed to call inside this loop
>>  to give the gui some processor time, without ipython blocking
>>  afterwards? I tried gtk.main_iteration() but this blocks the shell after
>>     
>
> Just for the sake of interest, try the latest IPython. It should not
> at least hang, it just stops feeding the commands to the GUI thread
> loop (MTInteractiveShell.runcode(), see Shell.py), and instead
> executes them immediately, until the GUI becomes 'alive' again.
>
> You can find the latest IPython at:
>
> https://launchpad.net/ipython/stable/0.8.3pre
>
> If you look at Shell.py, IPShellGtk class, you'll see that it
> registers on_timer event that keeps IPython alive. For some reason,
> that is probably not run after iter_mainloop()
>
>   


More information about the IPython-user mailing list