From 38d2e401f6fc562cb816c9807ef3b4a0e4010489 Mon Sep 17 00:00:00 2001 From: Thomas00010111 Date: Thu, 23 Jun 2016 13:14:24 -0700 Subject: [PATCH] Update multiprocess.py --- examples/misc/multiprocess.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/misc/multiprocess.py b/examples/misc/multiprocess.py index 510e9001fa3ee..be2735e0fa803 100644 --- a/examples/misc/multiprocess.py +++ b/examples/misc/multiprocess.py @@ -8,9 +8,8 @@ import numpy as np import matplotlib -matplotlib.use('GtkAgg') +matplotlib.use('TkAgg') import matplotlib.pyplot as plt -import gobject class ProcessPlotter(object): @@ -42,14 +41,16 @@ def call_back(): self.fig.canvas.draw() return True - return call_back + return call_back() def __call__(self, pipe): print('starting plotter...') self.pipe = pipe self.fig, self.ax = plt.subplots() - self.gid = gobject.timeout_add(1000, self.poll_draw()) + timer = self.fig.canvas.new_timer(interval=1000) + timer.add_callback(self.poll_draw) + timer.start() print('...done') plt.show() @@ -79,6 +80,7 @@ def main(): pl.plot() time.sleep(0.5) raw_input('press Enter...') +# input('press Enter...') #Python3 pl.plot(finished=True) if __name__ == '__main__':