Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Turtle Help
#1
I need to make three connected shapes. I keep recieving this error:
File "<stdin>", line 5
velez.color("MediumOrchid")
SyntaxError: invalid syntax

under curveLF
File "<stdin>", line 1, in <module>
NameError: name 'curveLF' is not defined

The following is my code.
Any ideas?
import turtle
wn = turtle.Screen()             
wn.bgcolor("plum")
belen = turtle.Turtle()          
belen.color("MediumPurple")
belen.pensize(5)
def curveRF():
    for i in range(200):
        belen.right(1)
        belen.forward(1)
belen.left(140)
belen.forward(111.75)
curveRF()
belen.left(120)
curveRF()
belen.forward(111.75)

ruby = turtle.Turtle()
def curveL():
    for i in range(200):
        ruby.left(1)
        ruby.forward(1)        
ruby.color("MediumVioletRed")
ruby.pensize(5)
ruby.speed(0)
ruby.left(-140)
ruby.forward(111.75)
curveL()
ruby.left(-120)
curveL()
ruby.forward(111.75)

velez = turtle.Turtle()
def curveLF():
    for i in range(200):
        velez.left(1)
        velez.forward(1)
velez.color("MediumOrchid")
velez.pensize(5)
velez.speed(0)
velez.right(50)
velez.forward(111.75)
curveLF()
velez.left(-120)
curveLF()
velez.forward(111.75)
wn.exitonclick()
Reply
#2
The first error says it's for line 5, but that's line 38. I ran your code and it worked fine.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
What program do you use?
Reply
#4
The one you posted. Is there another one?
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#5
Sorry, I mean, what compiler do you use?
Reply
#6
Uh, there are no compilers in Python. I ran it in Python version 3.6.3 on Windows. I just did another test with Python version 2.7.14. Again, no problems running the code, assuming it is supposed to draw three heart shapes.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How Can I Draw Circle With Turtle İn Python ? mdm 2 2,737 Jun-03-2021, 02:07 PM
Last Post: DPaul
  Divide a Python Turtle program into subprograms TurtleOHG 5 3,395 Mar-21-2020, 02:07 PM
Last Post: buran
  python idle turtle graphics help jojo 5 3,991 Apr-14-2019, 12:28 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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