> I guess there is no reason you can't do it with pylab after all, see
> animation_blit_qt4, for example. I think you would be better off using a gui
> timer/event handler like in the blit example.
>
> Darren

Darren, thanks a lot for your help!

I tried the animation_blit_tk example but it did not work as I expected it to. It still was not possible to resize or maximize the window while the animation was running.

However you gave me the clue to make it work by modifying the example just a little.

I have been looking for a while to a solution to this problem, so let me explain how I got it to work just in case someone is interested.

Basically, the original example (animation_blit_tk.py) does:

    manager = p.get_current_fig_manager()

followed by

    manager.window.after(1000, run)

to schedule the execution of a function (called run) 100 ms after the function pylab.show() function is called. The problem is that their run function has an infinite loop that does the animation and never exits. I guess that does not let the GUI thread respond to GUI events (maximize and resize).

Instead, the solution is to make the run function update the plot only once (i.e. do one single animation frame) AND then call manager.window.after(100, run) and return. This schedules the next animation frame but gives a chance to the GUI thread to responds to events.

The single question that I have is whether this .window.after function works with all types of GUI toolkits. I personally use Tk, since it comes builtin, but does it also work with Wx and QT?

Thanks a lot for your help, Darren!

Angel