Click here to Skip to main content
15,851,131 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm learning Python for a class and the assignment requires me to draw something in Turtle Graphics. I decided on what I was going to make but kept getting this error on the line where I put turtle.right(30).

This is how my code looks so far:
Python
import turtle

terry = turtle.Turtle
terry.size = (15)

def drawPoint( length ):
	terry.forward( length )
	terry.left(60)

def resetPosition( length ):
	terry.penup()
	setpos(0, length )
	terry.pendown()

def main():
	length = input("How large do you want the Star of David to be?")
	firstHalf = input("What color do you want half of the Star to be?")
	secondHalf = input("What color do you want the other half to be?")
	terry.color = firstHalf
	terry.right(30)
	beginFill()
	drawPoint( length )
	drawPoint( length )
	drawPoint( length )
	endFill()
main()


What I have tried:

I tried rearranging and reformatting the code, double checked the indentation, tried defining a variable to be the angle.
Posted
Updated 12-Oct-23 11:45am
v2

1 solution

Python
setpos(0, length )

Should be
Python
terry.setpos(0, length )


I just noticed that your instantiation is also incorrect at line 3, it should be
Python
terry = turtle.Turtle() # note the parenthesis
 
Share this answer
 
v2
Comments
CPallini 12-Oct-23 8:43am    
5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900