-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Update multiprocess.py #6637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update multiprocess.py #6637
Conversation
Updated in main repository. |
@@ -79,6 +80,7 @@ def main(): | |||
pl.plot() | |||
time.sleep(0.5) | |||
raw_input('press Enter...') | |||
# input('press Enter...') #Python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just make it conditional on sys.version_info
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also remove both lines, actually they do not add anything to this example.
In my version, which I derived from this example, I am using set_xdata and set_ydata to update the plot. Replotting becomes very slow because of the growing self.x and self.y array, but I guess that would be a new example. |
@@ -8,9 +8,8 @@ | |||
import numpy as np | |||
|
|||
import matplotlib | |||
matplotlib.use('GtkAgg') | |||
matplotlib.use('TkAgg') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're using canvas API now, this might be portable enough to not require setting a specific backend at all.
Wasn't sure if I needed the set a backend. Removed the line. |
@Thomas00010111 I tested it on OSX, It seems like not all the backends are fork safe on OSX
I suggest adding a comment about this along with a commented out backend selection. In my experience the qt backends work the best, i.e. add something like/
where you removed the other backend selection |
Thanks for testing on OSX. In my case I need to use matplotlib.use('QT4Agg'). |
Some more investigation reveals that the best solution to get this working reliably on OSX is to use a
|
Pasted your lines into the code. Uncommenting the lines gives an error message in my case. I am running Ubuntu 14.04 and Python 3.4. It seems that the forkserver is already the default. Traceback (most recent call last): |
The code setting the forkserver needs to be in the |
Ah, ok. Changed the code and the program works now. |
return True | ||
|
||
return call_back | ||
self.fig.canvas.draw() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to use draw_idle
which defers the actually drawing until the GUI decides to really repaint the screen.
There is some trailing whitespace in this file that the pep8 checker is catching. |
Changed to draw_idle() and found the white space. |
It seems I found a difference between draw_idle() and draw(). In my project I cannot use draw_idle(). I have a process (a quadcopter simulator) which generates data, this data should be shown in the graph, realtime would be nice but if the graphs lags behind a bit is not a problem. When I use draw_idle() the graph gets update at once when the simulation process is finished. So I cannot see the quadcopter moving. |
that shouldn't happen, something else must be wrong to cause behavior like Which backend are you using that you are seeing this behavior? On Thu, Jun 30, 2016 at 6:49 PM, Thomas00010111 notifications@github.com
|
For All of the backends should have a I have started to write this stuff up in #4779 |
Removed dependency to gobject (could not install/import package)
added () to return call_back