Apr-22-2020, 01:24 PM
Hi
I am struggling to work out why the colours arent changing in this program.
I have created a function called 'flowers' and i pass 3 colours in, as arguments as well as some others.
When i run the program all the colour selections turn out black.
I would appreciate some help, im been through the python manual and cant figure out why.
I am struggling to work out why the colours arent changing in this program.
I have created a function called 'flowers' and i pass 3 colours in, as arguments as well as some others.
When i run the program all the colour selections turn out black.
I would appreciate some help, im been through the python manual and cant figure out why.
import turtle
import random
fred=turtle.Turtle()
fred.speed(100)
def flower(x,y,petal_num,petal_col,center_col,square_col):
fred.penup()
fred.goto(x,y)
fred.pendown()
fred.begin_fill()
fred.color = str(petal_col)
for petal in range (petal_num):
for arc in range(2):
fred.circle(80,100)
fred.left(80)
fred.left(360/petal_num)
fred.end_fill()
fred.begin_fill()
fred.color = str(center_col)
fred.penup()
fred.goto(x,y-40)
fred.pendown()
fred.circle(40)
fred.end_fill()
fred.hideturtle()
fred.penup()
fred.goto(x,y)
fred.pendown()
fred.color = str(square_col)
def square():
for i in range (4):
fred.forward(35)
fred.right(90)
for pattern in range(36):
square()
fred.right(10)
flower(-200,-200,5,"honeydew","c","lavenderblush")
flower(200,200,7,"skyblue","yellow","cyan")
flower(-200,200,6,"salmon","deepskyblue","lightpink")
flower(200,-200,8,"skyblue","yellow","cyan")
flower(0,0,4,"skyblue","yellow","cyan")
