<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">main thread is owning the GUI. My Python installation runs <code style="font-size:13px;margin:0px;padding:1px 5px;border:0px;font-variant-numeric:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;background-color:rgb(239,240,241);white-space:pre-wrap;color:rgb(36,39,41)">Tkinter</code><span style="color:rgb(36,39,41);font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;font-size:15px"> version : 8.5 and this happens with Tkinter. I ran the same code on another machine which used another GUI framework(not sure what was it) and it went well. So I guess something is wrong with Tkinter.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 5, 2017 at 4:31 PM, Thomas Caswell <span dir="ltr"><<a href="mailto:tcaswell@gmail.com" target="_blank">tcaswell@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">GUI frameworks tend to require they be on the main thread.  Which backend / gui framework are you using here?<div><br></div><div>In general you will have to arrange things so that the main thread owns the GUI windows + plotting and the child threads own the computation.  </div><div><br></div><div>Tom</div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Aug 5, 2017 at 12:37 PM arash <<a href="mailto:azarmi@gmail.com" target="_blank">azarmi@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">(Resending to correct formatting)<br>
<br>
I am new to matplotlib and I am trying to get started with animation<br>
library.<br>
There is an example here for a simple strip chart:<br>
<br>
<a href="https://matplotlib.org/examples/animation/strip_chart_demo.html" rel="noreferrer" target="_blank">https://matplotlib.org/<wbr>examples/animation/strip_<wbr>chart_demo.html</a><br>
<br>
I tried to use this example in a thread. I created a simple<br>
*threading.Thread* class, and in it's *run()* method, called:<br>
<br>
*ani = animation.FuncAnimation(fig, scope.update, emitter, interval=10,True)<br>
plt.show()*<br>
<br>
here is class:<br>
<br>
*<br>
import matplotlib.pyplot as plt<br>
import matplotlib.animation as animation<br>
<br>
class graph(threading.Thread):<br>
<br>
    def __init__(self, feeder):<br>
        threading.Thread.__init__(<wbr>self)<br>
        self.fig, <a href="http://self.ax" rel="noreferrer" target="_blank">self.ax</a> = plt.subplots()<br>
        self.scope = Scope(<a href="http://self.ax" rel="noreferrer" target="_blank">self.ax</a>)<br>
        self.feeder=feeder<br>
        self.running=True<br>
<br>
    def run(self):<br>
        while self.running:<br>
            ani = animation.FuncAnimation(self.<wbr>fig, self.scope.update,<br>
self.feeder.emit_ch1(), interval=1, blit=True)<br>
            plt.show()<br>
*<br>
but when I start this thread, it never shows the windows. Isn't this right<br>
usage?<br>
<br>
<br><span class="HOEnZb"><font color="#888888">
<br>
--<br>
View this message in context: <a href="http://matplotlib.1069221.n5.nabble.com/animation-in-thread-tp48055p48056.html" rel="noreferrer" target="_blank">http://matplotlib.1069221.n5.<wbr>nabble.com/animation-in-<wbr>thread-tp48055p48056.html</a><br>
Sent from the matplotlib - users mailing list archive at Nabble.com.<br>
______________________________<wbr>_________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@python.org" target="_blank">Matplotlib-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/matplotlib-<wbr>users</a><br>
</font></span></blockquote></div>
</blockquote></div><br></div>