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()
Post Views: 7,012
15 Replies to “2019.06.25(am): How to draw random flower with python turtle”
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.
I?d have to check with you here. Which is not something I usually do! I enjoy reading a post that will make people think. Also, thanks for allowing me to comment!
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.
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.
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.
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.
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.
Thank you very much for the praise. I am very honored that somebody knows the value of blogs. Watch me. I will continue to write good articles. 🙂
I?d have to check with you here. Which is not something I usually do! I enjoy reading a post that will make people think. Also, thanks for allowing me to comment!
I am regular visitor, how are you everybody?
This piece of writing posted at this website is in fact good.
What’s up, its fastidious paragraph about media print, we all understand media is a impressive source of facts.
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.
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.
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.
Wow it’s my pleasure to hear your comment!
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.
Ok I will follow my heart