2019.06.04(am): How to draw star images with python turtle

code

import turtle
import random

turtle.tracer(0, 0)
wn = turtle.Screen()
wn.colormode(255)
turtle.bgcolor("black")
alex = turtle.Turtle()
alex.speed(10)
alex.goto(0,0)
alex.pensize(0)
alex.ht()
for i in range(400):
    alex.color(random.randrange(256),random.randrange(256),random.randrange(256))
    alex.goto(round(random.gauss(0,100),0),round(random.gauss(0,100),0))
    x = alex.xcor()
    y = alex.ycor()
    for j in range(25):
        s = round(random.gauss(0,5), 0)
        t = round(random.gauss(0,5), 0)              
      alex.color(random.randrange(256),random.randrange(256),random.randrange(256))
        alex.pensize(0)
        alex.goto(x + s, y + t)
    alex.goto(s,t)
turtle.update()
wn.exitonclick()

From: http://www.mrcolson.com/2015/12/09/Python-Art.html


Comments

6 responses to “2019.06.04(am): How to draw star images with python turtle”

  1. Hi I am so glad I found your web site, I really found you
    by mistake, while I was looking on Google for something else, Regardless I am here now and would just like to say thanks a lot for a
    marvelous post and a all round thrilling blog (I also love
    the theme/design), I don’t have time to go through it all at the moment but I have bookmarked it and
    also included your RSS feeds, so when I have time I will be back to read a lot
    more, Please do keep up the excellent b.

  2. I used to be able to find good information from your blog
    posts.

  3. Very good blog! Do you have any tips and hints for aspiring writers?
    I’m planning to start my own blog soon but I’m
    a little lost on everything. Would you propose starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I’m totally overwhelmed ..

    Any tips? Appreciate it!

  4. Attractive section of content. I just stumbled upon your website and in accession capital to
    assert that I acquire in fact enjoyed account your
    blog posts. Anyway I’ll be subscribing to your feeds and even I achievement you
    access consistently rapidly.

  5. I simply want to say I am beginner to blogging and really liked this web blog. Most likely I’m going to bookmark your blog post . You actually have terrific posts. Thanks a lot for revealing your website page.

Leave a Reply