Hi John, On Sun, May 3, 2009 at 00:21, John Hunter <jdh2...@gmail.com> wrote: > On Sat, May 2, 2009 at 9:42 AM, Sandro Tosi <mo...@debian.org> wrote: >> >> Hi all! >> 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 >> values. >> >> 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
you assume right :) > the timeout or idle handler and just check and see if new data has > arrived and then update as necessary. yeah, I solved with "gobject.idle_add" >> 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 ;) > > http://tinyurl.com/d7lkga > > Sorry :-) Couldn't resist ehhe :) but you're right, I've expressed the question wrongly: I was searching some python module / binding :) > (less obnoxious answer > http://www.cyberciti.biz/tips/how-do-i-find-out-linux-cpu-utilization.html) At the end I used subprocess module to call sar Cheers, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi ------------------------------------------------------------------------------ Register Now & Save for Velocity, the Web Performance & Operations Conference from O'Reilly Media. Velocity features a full day of expert-led, hands-on workshops and two days of sessions from industry leaders in dedicated Performance & Operations tracks. Use code vel09scf and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users