Cannot maximize figure while script is running

Hi,

I want to make a small python script that monitors a text file and plots its contents. This script is meant to run in Windows. The file that is being monitored has one floating point number per line and new numbers can be appended to the end of the file at any moment by some external program.

Therefore the script needs to keep reading the file and if new data is found, it should update the plot (a simple plot() command will do for now). To do so the script has an endless loop that tries to read new data and if it can it plots it and issues a pylab.draw() command.

I got the script working, (based on the “anim.py” example from the Matplotlib web page: http://matplotlib.sourceforge.net/examples/anim.py
). The script updates the plot correctly when new data is added to the file. However, the figure itself is not really functional. By that I mean that the figure cannot maximized while the script is running. It is not possible to change the zoom or use the toolbar either.

The example script has the same problem (i.e. the figure cannot maximized), so I’d like to know if there is any way around this or if I should use something other than pylab instead.

Thanks!

Angel

I would suggest not using the pylab interface. Try building off of one of the
embedding_in examples in
http://matplotlib.sourceforge.net/matplotlib_examples_0.90.0.zip.

Also, rather than repeatedly reading your data file to determine when new data
is available, I suggest using os.path.getmtime.

Darren

···

On Sunday 12 August 2007 3:56:14 am Angel Ezquerra Moreu wrote:

Hi,

I want to make a small python script that monitors a text file and plots
its contents. This script is meant to run in Windows. The file that is
being monitored has one floating point number per line and new numbers can
be appended to the end of the file at any moment by some external program.

Therefore the script needs to keep reading the file and if new data is
found, it should update the plot (a simple plot() command will do for now).
To do so the script has an endless loop that tries to read new data and if
it can it plots it and issues a pylab.draw() command.

I got the script working, (based on the "anim.py" example from the
Matplotlib web page: http://matplotlib.sourceforge.net/examples/anim.py).
The script updates the plot correctly when new data is added to the file.
However, the figure itself is not really functional. By that I mean that
the figure cannot maximized while the script is running. It is not possible
to change the zoom or use the toolbar either.

The example script has the same problem (i.e. the figure cannot maximized),
so I'd like to know if there is any way around this or if I should use
something other than pylab instead.