[Tutor] Fwd: Fwd: Turtle
Hershel Millman
hershel at themillmans.net
Sun Jun 19 19:21:28 EDT 2016
I entered "import turtle" instead of "from turtle import * ", but it looks as if it did not import the pendown command. Why is that?
import turtle
def drawSquare(size=100):
turtle.pendown
turtle.forward(size)
turtle.left(90)
turtle.forward(size)
turtle.left(90)
turtle.forward(size)
turtle.left(90)
turtle.forward(size)
turtle.left(90)
drawSquare(50)
input ()
Traceback (most recent call last):
File "/Users/Hershel/PycharmProjects/Project 1/practicefornotturtle.py", line 14, in <module>
drawSquare(50)
File "/Users/Hershel/PycharmProjects/Project 1/practicefornotturtle.py", line 4, in drawSquare
turtle.pendown
AttributeError: 'module' object has no attribute 'pendown'
Process finished with exit code 1
Begin forwarded message:
> From: Alan Gauld via Tutor <tutor at python.org>
> Date: June 19, 2016 1:47:44 AM MST
> To: tutor at python.org
> Subject: Re: [Tutor] Fwd: Turtle
> Reply-To: Alan Gauld <alan.gauld at yahoo.co.uk>
>
> On 19/06/16 04:46, Hershel Millman wrote:
>
>>> In pycharm, when I enter the following, it replies with the following error message:
>>>
>>> from turtle import *
>>>
>
> Change that to
>
> import turtle
>
> and it should work.
>
>
>
>>> def drawSquare(size=100):
>>> turtle.pendown()
>>> turtle.forward(size)
>>> turtle.left(90)
>>> turtle.forward(size)
>>> turtle.left(90)
>>> turtle.forward(size)
>>> turtle.left(90)
>>> turtle.forward(size)
>>> turtle.left(90)
>>>
>>> drawSquare(50)
>>>
>>> input ()
>
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list