[Edu-sig] IDLE and Matplotlib

Hans Fangohr H.FANGOHR at soton.ac.uk
Tue Jan 11 20:31:06 CET 2005

Dear all,

I am about to teach Python to a number of students who already know how to 
use Matlab (on a basic level). For that reason, the matplotlib library for 
plotting curves is ideally suited (it seems quite good anyway).

The teaching computers are Win XP machines. I have settled for the 
Enthough Python Edition and the latest matplotlib (both executables can be 
found in www.soton.ac.uk/~fangohr/download/python).

I have prepared the exercises on linux and am now trying to run them in 
windows. This is where I realised that matplotlib doesn't work well with 

More particularly, it is known that the default backend TkAgg doesn't work 
with IDLE (see here http://matplotlib.sourceforge.net/backends.html#TkAgg)
but it appears to work with "IDLE -n" (this is what it says on that web 

The problem I experience is this:

-start idle
-execute these commands:

   import pylab

This produces a figure window which seems to work fine.

At this point when closing the figure window, I can't get the IDLE 
prompt active again. (It seems that IDLE thinks the program and the figure 
process are still running, and is waiting for control to return.)

This, in itself, is maybe not suprising. However, the idle -n switch 
doesn't seem to solve the problem for me (see below).

The same problem is observed when I execute a program in the IDLE editor 
(by pressing F5).

What do people think how I should continue?

I could

  - try to make IDLE work with matplotlib (I think this is my preferred option)
    In that case, how do I tell IDLE on Windows to start with -n? (Not a
    Windows freak). In the start menu, I can change the properties for the
    link to idle from  '''

 	C:\Python23\pythonw.exe "C:\Python23\Lib\idlelib\idle.pyw"

 	C:\Python23\pythonw.exe "C:\Python23\Lib\idlelib\idle.pyw" "-n"

    but this doesn't seem to solve the problem: I get exactly the same
    behaviour as described above.

  - go to a completely different environment such as ipython. I am not
    too keen on this as the IDLE environment looks for familiar to the

  - suggest to run their programs by doubleclicking on them if they
    use matplotlib. This seems very ugly considering that you edit the file
    in the IDLE editor but you can't use it to execute the program.

    This is my backup solution.

I have addressed the matplotlib mailing list but am not to optimistic.

Does anyone have some experience with IDLE, matplotlib and IDLE on 
Windows machines?



Dr Hans Fangohr

Computational Engineering & Design Research Group
School of Engineering Sciences
University of Southampton
Southampton, SO17 1BJ
United Kingdom

Location: Building 25, Room 1027
phone : +44 (0) 23 8059 8345
fax   : +44 (0) 23 8059 7082
email : fangohr at soton.ac.uk

More information about the Edu-sig mailing list