2019.06.25(am): How to draw random flower with python turtle

from random import randrange
from turtle import Turtle, Screen

MAX_ANGLE = 30
MAX_DISTANCE = 250

def jaggedLine(turtle, pieceLength):
    randomColor(turtle)

    while turtle.distance(0, 0) < MAX_DISTANCE:
        angle = randrange(-MAX_ANGLE, MAX_ANGLE + 1)
        turtle.right(angle)
        turtle.forward(pieceLength)

def jumpToCenter(turtle):
    turtle.penup()
    turtle.home()
    turtle.pendown()

def randomColor(turtle):
    r = randrange(255)  # red component of color
    g = randrange(255)  # green component
    b = randrange(255)  # blue component

    turtle.pencolor(r, g, b)

def main():
    s = Screen()
    s.colormode(255)
    t = Turtle()
    t.pensize(2)
    t.speed('fastest')  # because I have no patience

    for angle in range(0, 360, 2):
        jumpToCenter(t)
        t.setheading(angle)
        jaggedLine(t, 30)

    t.hideturtle()

    s.mainloop()

if __name__ == "__main__":
    main()

15 Replies to “2019.06.25(am): How to draw random flower with python turtle”

  1. Can I just say what a relief to find someone who actually knows what theyre talking about on the internet. You definitely know how to bring an issue to light and make it important. More people need to read this and understand this side of the story. I cant believe youre not more popular because you definitely have the gift.

  2. Pingback: Google
  3. I do trust all the concepts you’ve introduced for your post.
    They are really convincing and will certainly work. Still, the posts are too short for novices.

    May just you please prolong them a little from next time?
    Thank you for the post.

  4. Hi i am kavin, its my first time to commenting anywhere,
    when i read this piece of writing i thought i could also make comment due to this brilliant post.

  5. Pingback: Google
  6. Pingback: Umzugsfirma Wien
  7. An impressive share! I have just forwarded this onto a friend who was conducting a little homework on this.
    And he in fact bought me lunch due to the fact that I discovered it
    for him… lol. So let me reword this….

    Thanks for the meal!! But yeah, thanx for spending some time to
    talk about this matter here on your web site.

  8. You can definitely see your skills in the work you
    write. The sector hopes for even more passionate writers such as you who aren’t afraid to say how they believe.
    All the time follow your heart.

Leave a Reply

Your email address will not be published. Required fields are marked *