Welcome to the beginner-friendly project - " The Polka Dot Generator "
Crafted and taught by Shreya Malogi! π
- Functionality: Generates stunning Hirst-inspired paintings using Python's Turtle module.
- Tech Stack:
Python
,turtle-GUI
- Author: @shreyamalogi
- Year of Project: 2021
- Introduction
- Prerequisites
- Installation
- Running the Script
- Customizing Your Painting
- Understanding the Code
This Python script utilizes the Turtle module to create a stunning Hirst-inspired painting. Let's embark on your artistic coding journey! π
Before you dive in, make sure you have Python installed on your machine. If not, you can download it here.
You'll need the turtle
module to run this script. Install it using:
pip install PythonTurtle
- Open the script in your favorite Python environment.
- Run the script. This will launch the Turtle graphics window.
The script uses a predefined color_list
variable containing RGB tuples. Feel free to customize this list to create your unique color palette. π
Let's break down the script:
import turtle as turtle_module
import random
# ... (other imports)
turtle_module.colormode(255)
myrtle = turtle_module.Turtle()
myrtle.speed("fastest")
myrtle.penup()
myrtle.hideturtle()
color_list = [(202, 164, 109), (238, 240, 245), ... , (176, 192, 209)]
# ... (more code)
screen = turtle_module.Screen()
screen.exitonclick()
colormode(255)
: Configures Turtle to use RGB values ranging from 0 to 255.Turtle()
: Creates a Turtle object namedmyrtle
.speed("fastest")
: Sets the drawing speed to the fastest.penup()
: Lifts the pen, so no drawing occurs when moving.hideturtle()
: Hides the turtle cursor.
The script uses a loop to draw dots on the canvas:
for dot_count in range(1, number_of_dots + 1):
myrtle.dot(20, random.choice(color_list))
myrtle.forward(50)
if dot_count % 10 == 0:
# ... (code for changing direction and position)
The script will create a unique Hirst-inspired artwork. Experiment with colors and settings to make it your own! Enjoy the creative process! π
Feel the magic within you? Contribute to this enchanting spellbook and make it even more magical. Don't forget to star the project! βπ
This project is enchanted under the spell of the MIT License. Share the magic responsibly!
MIT License
Copyright (c) 2021 Shreya Malogi
Stay Enchanted! ππ