Event handling... again

Hi,
Are there any caveats when using events together with IPython that you
are aware of? I have some code that I use to interactively explore
images that works OK when run from a Python interpreter but does not
(see note) when run from IPython. With --pylab option the problems are
more evident, but don't disappear completely without it. If I test
with some of the examples (i.e.
http://matplotlib.sourceforge.net/examples/event_handling/data_browser.html),
they work OK in both cases. I can't really post a working example, as
my code has grown large, and I am still trying to pin point the root
cause. I am posting also at the IPython ml, who knows

I'll appreciate any hints and or related problems you might have had,
that help me find a solution to this.

Jorge

Note: Does not run refers to *some* of the event handling defined not
working, for example I have defined specific keys that trigger the
loading of a new image

Just a wild guess: Any chance you’re using some GUI-toolkit-specific functionality?

-Tony

···

On Wed, Jul 4, 2012 at 10:14 PM, Jorge Scandaliaris <jorgesmbox-ml@…1664…> wrote:

Hi,

Are there any caveats when using events together with IPython that you

are aware of? I have some code that I use to interactively explore

images that works OK when run from a Python interpreter but does not

(see note) when run from IPython. With --pylab option the problems are

more evident, but don’t disappear completely without it. If I test

with some of the examples (i.e.

http://matplotlib.sourceforge.net/examples/event_handling/data_browser.html),

they work OK in both cases. I can’t really post a working example, as

my code has grown large, and I am still trying to pin point the root

cause. I am posting also at the IPython ml, who knows

I’ll appreciate any hints and or related problems you might have had,

that help me find a solution to this.

Jorge

Note: Does not run refers to some of the event handling defined not

working, for example I have defined specific keys that trigger the

loading of a new image

De: Tony Yu <tsyu80@...287...>

Just a wild guess: Any chance you're using some GUI-toolkit-specific functionality?

Can you elaborate please? I use the GTKAgg backend, and I guess IPython has specific mechanisms (I don't know the details) for keeping both the plot and the interpreter responsive, that's the --pylab option I mention. However, why am I the only asking for help here? Is it that just a few people use events and gtk backend and IPython?
My script, although larger and by now more complex, follows the lines of the example I gave earlier...

Jorge

Sorry, I wasn’t suggesting that it was a problem with the GTK backend; I was asking if you were explicitly calling GTK.

IPython --pylab starts an event loop for the default matplotlib backend (you can check this by printing plt.rcParams['backend']). If for some reason your default backend is not GTK and --pylab starts an event loop for that backend, then GTK-specific calls could cause problems. If this is the problem, you could set the backend in your matplotlibrc file. Alternatively, IPython has a -gthread command line option.

Like I said, this just a wild guess. Without example code, it’s hard to pin down.

-Tony

P.S. sorry for the duplicate, Jorge. I forgot to reply-all.

···

On Wed, Jul 4, 2012 at 11:11 PM, Jorge Scandaliaris <jorgesmbox-ml@…1664…> wrote:

De: Tony Yu <tsyu80@…287…>

Just a wild guess: Any chance you’re using some GUI-toolkit-specific functionality?

Can you elaborate please? I use the GTKAgg backend, and I guess IPython has specific mechanisms (I don’t know the details) for keeping both the plot and the interpreter responsive, that’s the --pylab option I mention. However, why am I the only asking for help here? Is it that just a few people use events and gtk backend and IPython?

My script, although larger and by now more complex, follows the lines of the example I gave earlier…

Jorge