[IPython-User] turtle lib

Thomas Kluyver takowl@gmail....
Wed Aug 15 16:58:31 CDT 2012


Hi Pietro,

On 15 August 2012 22:29, Pietro Terna <pietro.terna@unito.it> wrote:
>      using 'ipython notebook', is it possible to display the standard
> graphic output of the turtle lib directly inline? (As when we see
> matplotlib graphics inline).

It's not currently integrated, but I think with a bit of hacking you
could make it work:

Turtle uses tkinter behind the scenes, drawing on a Canvas widget,
which can save to postscript format (see
http://stackoverflow.com/a/6049340/434217). Then you can use a library
like PIL to convert that to png, which you can send to the frontend to
display.

Best wishes,
Thomas


More information about the IPython-User mailing list