Skip to content

Instantly share code, notes, and snippets.

@wanieldilson
Last active November 10, 2022 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wanieldilson/3205ec3f889a2ffeb78cac414ec7960a to your computer and use it in GitHub Desktop.
Save wanieldilson/3205ec3f889a2ffeb78cac414ec7960a to your computer and use it in GitHub Desktop.
Damien Hirst style dot painting generator (100 days of code). Simply run the .Py file to generate your own unique work of art!
import random
from turtle import Turtle, Screen, colormode
dot_colors = [(199, 175, 117), (124, 36, 24), (210, 221, 213), (168, 106, 57),
(222, 224, 227), (186, 158, 53), (6, 57, 83), (109, 67, 85),
(113, 161, 175), (22, 122, 174), (64, 153, 138), (39, 36, 36),
(76, 40, 48), (9, 67, 47), (90, 141, 53), (181, 96, 79), (132, 40, 42),
(210, 200, 151), (141, 171, 155), (179, 201, 186), (172, 153, 159),
(212, 183, 177), (176, 198, 203)]
# Configure Jim's properties, visibility and speed.
jim = Turtle()
jim.speed("fastest")
colormode(255)
jim.pensize(10)
jim.penup()
jim.hideturtle()
def draw_dots(number_of_dots):
for _ in range(number_of_dots):
jim.dot(20, random.choice(dot_colors))
jim.forward(50)
def reset_turtle(x, y):
jim.goto(x, y)
# Reset the turtle to centre the artwork onto the canvas.
# Create a variable to allow subsequent lines of dots to start in the right place
reset_turtle(-225, -215)
new_starting_point = -165
for _ in range(10):
draw_dots(10)
reset_turtle(-225, new_starting_point)
new_starting_point += 50
screen = Screen()
screen.exitonclick()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment