Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
turtle won't crawl
#1
EDIT: a workaround is: restart the shell each time, somehow the window killer remains in memory. Any way to reset this without restarting the shell??

When I installed Python in Win 10 for the gf, I saw she had examples of turtle. A nice clock, for example. I did not know about turtle.

So I am looking at it, here in tutorialspoint.com. Thought it might be fun to show some kids.

I import turtle in the Idle shell:

import turtle     
from turtle import *
But I immediately get an error from this simple example to draw a square (and other simple examples):

def myApp():        
    my_pen = turtle.Turtle()      
    for i in range(4):
       my_pen.forward(50)           
       my_pen.right(90)               
    turtle.done()
The error in Idle is:

Quote:>>> myApp()
Traceback (most recent call last):
File "<pyshell#34>", line 1, in <module>
myApp()
File "<pyshell#33>", line 2, in myApp
my_pen = turtle.Turtle()
File "/usr/lib/python3.6/turtle.py", line 3816, in __init__
visible=visible)
File "/usr/lib/python3.6/turtle.py", line 2557, in __init__
self._update()
File "/usr/lib/python3.6/turtle.py", line 2660, in _update
self._update_data()
File "/usr/lib/python3.6/turtle.py", line 2646, in _update_data
self.screen._incrementudc()
File "/usr/lib/python3.6/turtle.py", line 1292, in _incrementudc
raise Terminator
turtle.Terminator

Does anyone know what is wrong?
Reply
#2
You might want to read up on the "turtle.done()" statement.
It is not recommended to be used with all editors.

Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  wn = turtle.screen() AttributeError: module 'turtle' has no attribute 'screen' Shadower 1 6,171 Feb-06-2019, 01:25 AM
Last Post: woooee
  Help! Turtle not working, even when we click the turtle demo in IDLE nothing happens. BertyBee 3 5,615 Jan-04-2019, 02:44 AM
Last Post: SheeppOSU

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020