It's a backend issue:the code works with wxagg but not with gtkagg.

On 1 November 2010 00:54, Sameer Grover <sameer.grove...@gmail.com> wrote:
> Can matplotlib be used in scripts with multiple processes, such as
> when using the multiprocessing module?
>
> I had some difficulty getting code to work in which I was carrying out
> some long computations and wanted to show intermediate results in a
> separate process so as not to interrupt the main computation. The
> problem distilled down to trying to use the multiprocessing module and
> matplotlib together. This is a code snippet which I expected to work,
> but doesn't. Is this a matplotlib issue, some intricate issue with
> GUIs and processes, or something with my understanding of the subject?
>
> Would you expect this code to work? Is there any easy workaround?
>
> from pylab import *
> import multiprocessing
> class myclass(object):
>    def plotter(self):
>        plot([1,2,3,4])
>        show()
>    def mainfunction(self):
>        a = arange(1, 10, 0.1)
>        newprocess = multiprocessing.Process(target=self.plotter)
>        newprocess.start()
>        newprocess.join()
>        plot(a, sin(a))
>        show()
> if __name__== '__main__':
>    a = myclass()
>    a.mainfunction()
>
> Thanks,
> Sameer
>

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to