[IPython-user] gtk.main_iteration() blocks ipython
Pieter Cristiaan de Groot
Mon Apr 7 17:12:58 CDT 2008
I would like to interact with a gtk gui, while the main ipython shell is
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
completion of loop.
I would like to be able to interrupt a running loop in the ipython shell
(usually started through 'execfile' ) with a 'stop' button on a gtk-window.
What I tried to do:
1) gtk button toggles global variable if 'abort' is necessary
2) loop contains check for the value of this global variable
3) loop contains ' gtk.main_iteration()' to actually give the gui
processor time to see if the button was clicked
This basically works, but it turns out that calling
'gtk.main_iteration()' from the ipython shell blocks the entire shell.
Is there an alternative that I should use?
Any help would be appreciated, also suggestions for achieving the same
goal in another way that I cannot think of. I keep on having the
impression that the way I try to do it is rather brainless..... But an
alternative seems hard to find.
thanks in advance
More information about the IPython-user