From: Todd M. <jm...@st...> - 2004-05-24 14:47:26
|
On Sat, 2004-05-22 at 23:01, Gary Pajer wrote: > > I've been trying to figure out how to do an dynamic update in TkAgg > without > > success. Anyone have any pointers? > > I'm trying to recreate the functionality of the Pmw.Blt stripchart. > > > > -gary > > > > I guess I should be a little more specific. The part I'm having trouble > with is the dynamic update. As a step along the way, I've got a gui with a > button that just replots some data slightly altered from the original. > > If I use FigureCanvasTkAgg.show (schematically speaking) it will replot, but > just once. That is, my button's callback routine contains a loop that tries > to change the data (via set_ydata followed by ....show()) several times in a > row. If I click the button, the data updates, but only once. I click it > again, it the data updates once. I remove the loop, the data updates once. > This strikes me as odd. How should the graphics window know or care if I'm > in a python loop or not? > > I'm thinking that a well-placed call to > canvas.get_tk_widget.update_idletasks() should do the job, but that hasn't > worked for me either. > > Aside: having played with anim.py I'm concerned about speed. It seems that > the speed of anim.py is limited by my system, not by the call to > gtk.timeout_add(). I might be back asking about a solution that runs faster > ... perhaps a lower level solution. (Pmw.Blt works fast enough.) Hmm... I > just tried anim.py again, and it won't run. I've just upgraded to 0.54. > Odd ... it opens a Tk window. I'll try that again later after I reboot. > I'm on WinXP. > > Comment: I don't have a handle at all on how the graphics system is > organized. For example, what is a figure manager? When do I use it? I > don't seem to need it, but there it is, and some of the examples use it. > Looking through the docstrings I find myself going in circles. Maybe I'm > digging too deeply for my own good. Maybe you developer types might add to > your to-do list a description of the stucture of the graphics system. > > thanks again, > gary > > btw, for every task other than animation, matplotlib is the bomb. great > job. > I tried porting anim.py to TkAgg this morning and got it basically working. There are two things that might account for the trouble you've been having: 1. With TkAgg, at least for now, you have to call the figure manager show() method with each cycle rather than the canvas draw() method. 2. The Tk timed event system requires re-registering the handler with each cycle. Performance was better than I thought it would be but still kinda slow. Hope this helps, Todd Todd Miller <jm...@st...> |