Re: Plotting to a matplotlib / pyplot window does not work
Matthias Brennwald <[email protected]>
| Newsgroups | gmane.comp.python.wxpython |
|---|---|
| Message-ID | <[email protected]> |
On Do, Jul 23, 2020 at 13:46, Andrea Gavana <[email protected]> wrote: > If the plotting part is relatively quick, there shouldn't be any > pile-up of events, unless the rate of data coming in from your > instrument exceeds the FPS of your plotting. At that point the GUI is > busy plotting stuff only, which is not good. If you have a very high > rate of wx.CallAfter stuff coming in, then I suggest you update the > plot every N times instead of every time something comes in. Yeah, this is essentially what I am doing, see the example I attached in my earlier post. However, I had to make some glue code that prevents the wx.CallAfter calls from piling up (sorry, I mixed up CallAfter and CallLater in my previous post). I wonder if there is a way to avoid this glue code by using some mechanism or approach that is "built in" wxPython. On Do, Jul 23, 2020 at 07:15, Matt Newville <[email protected]> wrote: > One alternative would be to use a simple Timer that calls a function > to "fetch the latest data and display it". That can then run at the > natural rate for your GUI client to fetch the data and render that > display. This approach allows the GUI to be responsive, and not > miss any data even if it does not update exactly once for every > single data event. It also gives you a convenient method to > temporarily pause the display (just have access to the Timer's stop() > and start() methods). This sounds like a great idea! This would allow the plot windows to deal with the updating on their own, so the thread dealing with the getting the data from the instrument does not need to care about the plots. I have no clue about Timers, though... can you point me in the right direction? -- You received this message because you are subscribed to the Google Groups "wxPython-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/SJAXDQ.ML1VQWN6QUPX1%40gmail.com.