I guess you're using ipython in pylab mode, correct? If you want to make a standalone application, I recommend you not to use ipython pylab mode. Instead, use your own gui toolkit. Take a look at following examples.
http://matplotlib.sourceforge.net/examples/user_interfaces/index.html However, a quick solution in your case would be using canvas = gcf().canvas canvas.start_event_loop(timeout=10) instead of time.sleep. In ipython pylab mode, the mainloop of the gui backend is blocked while your command is running (e.g., time.sleep function in your example, Tk is the only exception I know). To have your figure canvas responsive while you're running your code, the code you're running need to explicitly process the gui event of the canvas (this is what start_event_loop in above example is for). Again, start_event_loop may be used in your case for a quick solution, but I personally recommend you to develop within the framework of your gui choice (matplotlib does have its own gui-neutral event model, but I don't think a timeout event is supported). IHTH, -JJ On Wed, Apr 1, 2009 at 7:44 PM, VC <vasc...@gmail.com> wrote: > Hi all, > > I am experiencing the following difficulty: > > My program basically loops and wants to redraw a plot (using imshow() ) > every 5 seconds or so. So it looks something like: > > ion() > while 1: > do redraw business.. > time.sleep(5) > > The redrawing shows up fine, the only problem is that during the 5 seconds > of sleep, I cannot really move the figure window or really do anything with > it. > > I am using MPL on windows with the 'Qt4Agg' backed, and running this code > from ipython (on the command line). I don't quite understand the threading > model of the GUI kit, vs. the main thread, so could someone enlighten me how > it works roughly, and what I need to do in a multi-threaded application in > order to update a figure periodically, and be able to move it around, and do > things with its figure window. > > Thanks in advance for any responses. > ------------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > ------------------------------------------------------------------------------ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users