First Question
I was doing an example from ThinkPython 2e Chapter 4 Case Study: Interface Design, when I stumbled upon turtle module.
I use jupyter notebook as an IDE to do exercise. Here's the code
import turtle
bob = turtle.Turtle()
When I ran the code above, the code is exected but Python Turtle Graphic failed to run with 'Not Responding' status
The same goes for this, although when I ran the following, the kernal is busy for a while before stating an error
import turtle
bob = turtle.Turtle()
print(bob)
turtle.mainloop()
What caused this error?
Second Question
Then I tried the next code which is
bob.fd(100)
and it just froze so I have to interrupt the code, here's the error
---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
<ipython-input-7-a3ce06f254ac> in <module>
2 bob = turtle.Turtle()
3 print(bob)
----> 4 turtle.mainloop()
~\Anaconda3\lib\turtle.py in mainloop()
~\Anaconda3\lib\turtle.py in mainloop(self)
811
812 """
--> 813 TK.mainloop()
814
815 def textinput(self, title, prompt):
~\Anaconda3\lib\tkinter\__init__.py in mainloop(n)
558 def mainloop(n=0):
559 """Run the main loop of Tcl."""
--> 560 _default_root.tk.mainloop(n)
561
562 getint = int
KeyboardInterrupt:
What I have tried
I've tried to refer to this thread
Turtle does not run more than once in jupyter notebook
which eventually leads me back to here
https://medium.com/@jiyuanli93/how-to-make-python-turtle-works-in-jupyter-notebook-6c506b9a973f
or here
a little information : when I run this on my Anaconda prompt
$ jupyter nbextension install --py --symlink --sys-prefix ipyturtle
$ jupyter nbextension enable --py --sys-prefix ipyturtle
It generated some problems, but ran perfectly (it's said validating: ok
) when I ran them as admin
any help would be appreciated, I've been stuck with this stuff for 2.5 hours