question about animation and widgets

in fact that may become clearer with my code.
There are two classes. One does the animation. The other is supposed to add a button. The infinite loop is at the end

Bruno

Greg Willden a �crit :

rollinggraph.py (4.1 KB)

···

Hi Bruno,

Which method are you using to do the animation?
Timer, Idle Event?

If you are using a timer then it is pretty straightforward to start and stop the timer from the handler for the button you added.

I am using wxPython and I've hacked the animation_blit_wx.py example.

You need functions like this:
timer = wx.Timer(panel,TIMER_ID)
wx.EVT_TIMER(panel,TIMER_ID, update_line) << Here you bind the timer to your update function

timer.Start(10)
timer.Stop()

Cheers,
Greg

On 8/16/07, *bruno* <bruno.chazelas@...1698... > <mailto:bruno.chazelas@…1698…>> wrote:

    Hello,

    I am probably reinventing the wheel. I am trying to get "rolling"
    graph
    a la labview with matplotlib. I have more or less managed to get
    what I
    want using the simple animation technique provided by matplotlib. I
    would like now to have a button an the same graph that would enable me
    to stop the program that is in an infinite acquisition loop.

    I have managed to use a matplotlib widget with the graph to make it
    print something on a terminal, however I do not see how to make it
    stop
    an infinite loop. I have tried to make the button change the state
    of a
    variable and give the state of this variable a a stop condition to the
    loop. However this doesn't work. In fact the button doesen't seems
    to be
    "listening" during the loop.

    Any idea of how I should be doing that ?

    Cordially

    Bruno

    -------------------------------------------------------------------------
    This SF.net email is sponsored by: Splunk Inc.
    Still grepping through log files to find problems? Stop.
    Now Search log events and configuration files using AJAX and a
    browser.
    Download your FREE copy of Splunk now >> http://get.splunk.com/
    _______________________________________________
    Matplotlib-users mailing list
    Matplotlib-users@lists.sourceforge.net
    <mailto:Matplotlib-users@lists.sourceforge.net>
    matplotlib-users List Signup and Options
    <https://lists.sourceforge.net/lists/listinfo/matplotlib-users&gt;

--
Linux. Because rebooting is for adding hardware.