turtle, ipython, and pylab don't mix

Robert Kern robert.kern at gmail.com
Wed Jan 20 11:06:26 EST 2010


On 2010-01-20 08:40 AM, Brian Blais wrote:
> Hello,
>
> I am noticing a hard crash of the ipython interpreter, with the pylab
> option, with the turtle module. I am on Win XP, Enthought Edition 6.0.0
> which uses Python 2.6. I can't reproduce it without the pylab option,
> nor on the Mac (with an earlier Enthought Edition). The crash happens
> only when I try to move the turtle window, after it has drawn. The
> following commands are enough to give the resulting error.
>
> In [1]: from turtle import *
>
> In [2]: pendown()
>
> In [3]: forward(10)
>
> In [4]: Fatal Python error: PyEval_RestoreThread: NULL tstate
>
> This application has requested the Runtime to terminate it in an unusual
> way.
> Please contact the application's support team for more information.
>
>
> Any ideas? Of course, I'll use it without the pylab option, but that
> means that there are two icons I need instead of one. Minor
> inconvenience for me, but a bit more of a pain for my students.

The IPython list is probably a better place for this question. Is suspect that 
the problem is the mixing of GUIs. turtle uses Tk, but I suspect that your 
configured matplotlib backend is WxAgg. "ipython -pylab" will bring up a wx 
application as the main thread for execution of the code you type. When you try 
to bring in another GUI event loop, something goes awry.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list