[SciPy-user] Mlab doesn't work

Ryan May rmay31@gmail....
Wed Jun 18 19:20:30 CDT 2008


Gael Varoquaux wrote:
> On Wed, Jun 18, 2008 at 02:07:08PM +0200, Alexander Borghgraef wrote:
>> After commenting out nearly everyting, it seemed that there was some
>> incompatibility between mlab and pylab (which I use for 2D plotting).
>> For example, this works fine:
> 
>>   from enthought.mayavi import mlab
>>   from scipy import lena
>>   mlab.surf(lena())
> 
>> But this results in the above mentioned error:
> 
>>   import pylab
>>   from enthought.mayavi import mlab
>>   from scipy import lena
>>   mlab.surf(lena())
> 
> Interesting. I was not aware of this problem, but it partly makes sense.
> The problem is that pylab, as you are probably using it, uses the TK
> toolkit, whereas mayavi uses the Wx. Running both event loops in the same
> time results in a nice segfault due to race conditions.
> 
> The solution is to have pylab use the Wx event loop. You can do this by
> doing (before importing pylab):
> """
> import matplotlib
> matplotlib.use('WxAdd')
		    ^^^

You mean:
matplotlib.use('WxAgg')

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma


More information about the SciPy-user mailing list