James K. Gruetzner wrote:
I'm running Fedora 8, python 2.5.1, and matplotlib 0.91.2-1.fc8 from
the yum repository. Backend is set to GTKAgg in my matplotlibrc file.
(On this list top-posting is frowned upon -- it makes the conversation
difficult to follow.)
I understand. Sorry. Each list is different: I'm new here, and will try remember.
No problem. Also, don't forget reply-to-all, so that the whole of the list can chime in here.
Your analysis is correct, the call to show() activates the GUI mainloop
and does not return until the window is closed. Within ipython there is
some magic that occurs that runs the mainloop in a separate thread.
What do you need to do after the call to show()?
In my current situation, I need to extract and display data (images) independently from several different files as part of debugging a larger application. (I'm really not reading a file into the original array, but running some shell commands using os.popen2(...) to eventually populate the array: that part works.) The upshot is that in the course of a few hours, I may have to display (and kill) a large number of images.
The current "hang" means that I have an effective memory leak, and I'd have to keep track of Process IDs and manually kill them every so often. Were the pylab.show() command to return after closing the window (clicking on the X), then a backgrounded or daemon process should terminate. But it doesn't. This seems to be the same problem causing Dragan S.'s problem.
I'm not sure if this is a bug or a feature, but would assuredly like to find a way to kill the leak.
I'm not sure about the lack of returning after the call show(), though it does sound like a bug. What I *do* know is that multiple calls to show() is frowned upon (if not just completely unsupported). What you probably want to look at is the dynamic_image_gtkagg.py example (in the examples/ directory). Since you're already using GtkAgg, it should be *really* easy to adapt the example to fit your needs. I've personally adapted it to do a live data display of a simulation run. If you *need* it to wait for user interaction before continuing, there might be a little bit more work, but I don't think it'd be much. You could probably instead look at some of the Matplotlib UI widgets, like in the buttons.py example.
Graduate Research Assistant
School of Meteorology
University of Oklahoma