I have been using turtle package in python idle. Now I have switched to using Jupyter notebook. How can I make turtle inline instead of opening a separate graphic screen. I am totally clueless about. Any pointers and advice will be highly appreciated.
Asked
Active
Viewed 1.2k times
10
-
2`turtle` uses `tkinter` which can't run in `Jupyter Notebook`. `Jupyter Notebook` can display only `HTML`. – furas Jan 21 '17 at 21:09
-
3BTW: [trinket.io](https://trinket.io/) can run turtle code in browser but it uses JavaScript to interpret Python code - so it may not work with `Jupyter notebook` – furas Jan 21 '17 at 21:16
-
1Thank you so much for the answer. I have been thinking of developing teaching material for kids. Btw, where can I read and know more about package compatibility and capability. – dearbharat Jan 22 '17 at 05:14
-
1about "capability" of standard modules you can read in standard documentation: https://docs.python.org/3.5/library/ . Other modules should have own documentation in different places but Google should find it. About "compatibility" you can only find information if it compatible with Python 2 or/and Python 3. Most graphics modules and GUI aren't compatible with Jupyter because they use system elements to display graphics/widgets, they doesn't generate HTML/CSS/JavaScript. – furas Jan 22 '17 at 14:39
-
2BTW: materials (more or less) for kids: [Program Arcade Games With Python And Pygame](http://programarcadegames.com/) , [Hour of Code](https://hourofcode.com/) , [Hour of Code - Minecraft](https://code.org/minecraft) , [Python Graphics.py module](http://mcsp.wartburg.edu/zelle/python/) (it uses Tkinter in background) , [Python and Minecraft](http://www.instructables.com/id/Python-coding-for-Minecraft/), [Python and Lego Mindstorm](http://inspiredtoeducate.net/inspiredtoeducate/programming-lego-mindstorms-ev3-with-python/) – furas Jan 22 '17 at 14:49
-
1Thank you for your guidance and other resources for kids @furas. It is a great help. I will look at the documentation. – dearbharat Jan 27 '17 at 07:25
3 Answers
3
I found the following library that has a Turtle implementation working in Jupyter notebooks: https://github.com/takluyver/mobilechelonian

marco
- 488
- 4
- 9
-
I did not try Jupyterlab. But it works fine in both the notebooks at jupyter.org and notebooks.azure.com (standard jupyter notebooks). – marco Aug 26 '18 at 15:17
-
1I wonder how you made it work with azure notebooks, @marco. It does not seem to work for me (i.e. code executes, but turtle does not appear). Do I need to install some extension manually? – Dmitri Soshnikov Oct 19 '18 at 16:07
3
With python3.6+:
python -m pip install ipyturtle3
Try the examples listed in this repo: https://github.com/williamnavaraj/ipyturtle3
https://pypi.org/project/ipyturtle3/
I found this to work in JupyterLab and VSCode

William
- 464
- 2
- 16
1
I am a windows user, so run the CMD as an administrator and run this:
jupyter nbextension enable --py --sys-prefix ipyturtle
Run the above after installing the ipyturtle
pip3 install ipyturtle

das-g
- 9,718
- 4
- 38
- 80

Denzel Akwanie
- 22
- 3