IDLE python shell freezes after running show() of matplotlib

F

Forrest Sheng Bao

I am having a weird problem on IDLE. After I plot something using show
() of matplotlib, the python shell prompt in IDLE just freezes that I
cannot enter anything and there is no new ">>>" prompt show up. I
tried ctrl - C and it didn't work. I have to restart IDLE to use it
again.

My system is Ubuntu Linux 9.04. I used apt-get to install IDLE.
 
D

Donny

I have this problem as well. I'm on Windows XP (32-bit x86 processor)
using Python 2.6.4 and matplotlib 0.99.1 (installed with
matplotlib-0.99.1.win32-py2.6.exe). The IDLE version is 2.6.4. The
difficulty occurs for me during the first example of the (official?)
Pyplot tutorial at <http://matplotlib.sourceforge.net/users/
pyplot_tutorial.html>, so it is possible that many new users of pyplot
experience this same difficulty:

import matplotlib.pyplot as plt
plt.plot([1,2,3])
plt.ylabel('some numbers')
plt.show()

I see the plot, and I can close the plot window by clicking on the X
at the upper-right corner of the plot window. However, as Forrest
mentioned, IDLE does not then spit out the next command prompt, nor
does IDLE respond to a Ctrl-C.

I have found that by turning on pyplot's 'interactive mode', the above
problem does not occur:

import matplotlib.pyplot as plt
plt.ion()
plt.plot([1,2,3]) # plot opens after this command is issued, and new
command prompt appears
plt.ylabel('some numbers') # if plot is not closed before issuing this
command, then the open plot window is updated
plt.close() # same effect as manually click-closing the plot window
 
O

OKB (not okblacke)

Forrest said:
I am having a weird problem on IDLE. After I plot something using show
() of matplotlib, the python shell prompt in IDLE just freezes that I
cannot enter anything and there is no new ">>>" prompt show up. I
tried ctrl - C and it didn't work. I have to restart IDLE to use it
again.

My system is Ubuntu Linux 9.04. I used apt-get to install IDLE.

I believe this is the intended behavior. Look in matplotlib
documentation on the difference between interactive and non-interactive
modes.

--
--OKB (not okblacke)
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is
no path, and leave a trail."
--author unknown
 
C

Chris Colbert

This is a threading issue that is very common when using gui toolkits
with the interactive interpreter.

You're better off just using ipython, which already has builtin
support for matplotlib when you start it via "ipython -pylab"
 
M

Michael

This is a threading issue that is very common when using gui toolkits
with the interactive interpreter.

You're better off just using ipython, which already has builtin
support for matplotlib when you start it via "ipython -pylab"

Same problem for me using IDLE 1.2.4, python 2.5.4, and matplotlib
0.99.1.1. Windows XP 32bit.

Turning on interactive mode solved the problem with IDLE freezing,
however the plot window still comes up empty and frozen.

Using iPython now with no problems so far. Hopefully the problem with
IDLE gets fixed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top