Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- from turtle import Screen, Turtle
- # import turtle
- # import cv2
- wn = Screen()
- # wn = turtle.Screen()
- wn.title('Buat Diva')
- tina = Turtle()
- # tina = turtle.Turtle()
- tina.shape("circle")
- tina.color("black")
- tina.speed(0)
- def drawSunflower(t, numseeds, numpetals, angle, cspread):
- # t.fillcolor("red")
- #ff6961
- # t.fillcolor((255,105,97))
- # col = input("Enter the color name or hex value of color(# RRGGBB): #ff6961")
- t.fillcolor('#ff6961')
- phi = angle * (math.pi / 180.0)
- for i in range (numseeds + numpetals):
- # figure out the next x, y position
- r = cspread * math.sqrt(i)
- theta = i * phi
- x = r * math.cos(theta)
- y = r * math.sin(theta)
- # move the turtle and orient it correctly
- t.penup()
- t.goto(x, y)
- t.setheading(i * angle)
- t.pendown()
- if i < numseeds:
- t.stamp()
- else:
- drawPetal(t)
- def drawPetal(t):
- t.fillcolor("pink")
- # t.fillcolor("white")
- t.begin_fill()
- t.right(20)
- t.forward(70)
- t.left(40)
- t.forward(70)
- t.left(140)
- t.forward(70)
- t.left(40)
- t.forward(70)
- t.end_fill()
- drawSunflower(tina, 120, 40, 137.508, 4)
- tina.up()
- tina.goto(0, -240)
- tina.down()
- tina.write("hope u like it :D", align="center", font=("Comic Sans", 16, "normal"))
- tina.hideturtle()
- # cv2.destroyAllWindows()
- wn.exitonclick()
- # tina.hideturtle()
- # from turtle import Screen, Turtle, mainloop
- # def draw_square(turtle):
- # turtle.forward(100)
- # turtle.right(90)
- # turtle.forward(100)
- # turtle.right(90)
- # turtle.forward(100)
- # turtle.right(90)
- # turtle.forward(100)
- # turtle.right(90)
- # window = Screen()
- # window.bgcolor("red")
- # brad = Turtle()
- # brad.shape("turtle")
- # brad.color("yellow")
- # brad.speed(2)
- # draw_square(brad)
- # mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement