[SciPy-user] Solved-ish: matplotlib, Tkinter and multi-threaded web applications

Darren Dale darren.dale@cornell....
Sun Oct 14 19:41:38 CDT 2007

On Sunday 14 October 2007 08:27:32 pm zunzun@zunzun.com wrote:
> On Sun, Oct 14, 2007 at 07:23:19PM -0500, Robert Kern wrote:
> > Please show us the code that you used on the matplotlib list.
>         # pylab uses Tkinter, so this must be the top-level thread calling
> Tk. # calling pylab.close() here forces pylab to create a new top-level
> thread pylab.close()
>         # tell matplotlib to use the 'Anti-Grain Geometry' toolkit
>         matplotlib.use('Agg')

Like Robert said, you have to call matplotlib.use *before* importing pylab.

import matplotlib
import pylab

More information about the SciPy-user mailing list