Re: Plotting to a matplotlib / pyplot window does not work

Andrea Gavana <[email protected]>
Newsgroups gmane.comp.python.wxpython
Message-ID <CAEf70bzXOgK7OsT-GQRswo8Dso0JZmdmKZPUyePe0ykkp-eu_w@mail.gmail.com>
Hi,

On Mon, 20 Jul 2020 at 18.04, Matthias Brennwald <[email protected]> wrote:

> I am trying to to make a wxPython program that controls a measurement
> instrument. The access to the instrument happens via a Python class. That
> class configures a matplotlib / pyplot window, where the measured data are
> plotted. In the wxPython application, the data acquisition (and hence the
> plotting) happens in a thread that is separate from the GUI, because this
> is a slow and long-running process that must not block the GUI.
>
> If I use this class from within my wxPython application, the data plotting
> does not work. Plotting works fine if I use the instrument class without
> wxPython.
>
> (The instrument class is here:
> https://github.com/brennmat/ruediPy/blob/master/python/classes/rgams_SRS.py
> )
>
> Any thoughts what's going on? Any clues what to check or where to look for
> the reason why the  combination of matplotlib/pyplot with wxPython not work
> in my case?
>


Your instrument class is 2,263 lines long. Kind of hard to go through it
and find what wrong for those of us who are not acquainted with your code,
isn’t it?
I use Matplotlib with wxPython all the time and I never had any problems.
You should probably try and create a small runnable sample that reproduces
the problem; also, If you are using  separate threads you haVe to be
especially careful when it comes to communicating with the GUI part in
wxPython. Only the main thread can access GUI stuff (meaning the thread the
creates the GUI), and communications from other threads can be achieved
using wx.CallAfter, wx.PostEvent, PubSub, etc...

Andrea.

-- 
> 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/YAZRDQ.FU2SPKG6O7G5%40gmail.com
> <https://groups.google.com/d/msgid/wxpython-users/YAZRDQ.FU2SPKG6O7G5%40gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAEf70bzXOgK7OsT-GQRswo8Dso0JZmdmKZPUyePe0ykkp-eu_w%40mail.gmail.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.