I'd like to embed a mpl graph into a GTK application (and for that
embedding_in_gtk*.py examples are fine) but I would also like to
dynamically update the graph with time.
Consider like if I want to plot some dynamic system information, like
cpu usage, memory occupation, or so. Than I want to gather those info
at 1 sec interval, and dynamically update the graph adding the new
How can I do it? I'm stuck with the "update data as they come" part
(please note I need for GTK embedded mpl code).
The idioms in the examples/animations dir should be directly portable
to an embedded gtk app, eg simple_anim_gtk.py,
dynamic_image_gtkagg.py, etc. You will need to either use an idle
handle, a timeout handler, or a special event in the gtk event
handling framework to trigger an update to the data and draw. You can
extend the gobject signals to handle custom events (eg data arrives)
if you want to go this route, but since you are trying to illustrate
mpl more than gtk (I assume) you may want to go the easy route and use
the timeout or idle handler and just check and see if new data has
arrived and then update as necessary.
PS: if there's someone that knows how to gather cpu percentage usage
on a linux sys, please tell me It seems not that easy to find it
out from google
Sorry Couldn't resist (less obnoxious answer
On Sat, May 2, 2009 at 9:42 AM, Sandro Tosi <morph@...10...> wrote: