A colorful, interactive generative art project built with Pythonβs built-in
turtlemodule β no pip installs needed!
β¦ ββ β¦ ββ β¦
β± β²
β¦ πΈ MANDALA πΈ β¦
β² β±
β¦ ββ β¦ ββ β¦
Mandala Pattern Generator ek Python project hai jo sirf turtle aur colorsys (dono built-in) use karke 5 beautiful generative art patterns draw karta hai. Ek bhi library install nahi karni β bas run karo aur enjoy karo!
tracer(0) se flicker-free drawing| Key | Pattern | Description |
|---|---|---|
1 |
πΈ Petal Mandala | 36 overlapping rainbow arcs β classic mandala look |
2 |
β Star Burst | 72 colorful spokes radiating from center |
3 |
π Spiral Mandala | 8-sided polygon jo bahar ki taraf spiral karta hai |
4 |
πΉ Rose Curve (Rhodonea) | Mathematical rose β r = cos(nΞΈ) β 2 layers |
5 |
π΅ Layered Circles | 12 concentric rings, har ring mein zyada circles |
Q |
β Quit | Window band karo |
Python built-in hai β kuch install nahi karna!
# Clone the repo
git clone https://github.com/yourusername/mandala-generator.git
cd mandala-generator
# Run karo
python mandala.py
# Ya python3 ke saath
python3 mandala.py
β Requirements: Python 3.x β Koi external library nahi!
mandala-generator/
β
βββ mandala.py # All 5 patterns + keyboard controls + menu
Yeh ek single-file project hai β sab kuch ek hi file mein! π―
βββββββ¬βββββββββββββββββββββββββββββββββββββββ
β Key β Action β
βββββββΌβββββββββββββββββββββββββββββββββββββββ€
β 1 β πΈ Draw Petal Mandala β
β 2 β β Draw Star Burst Mandala β
β 3 β π Draw Spiral Mandala β
β 4 β πΉ Draw Rose Curve Mandala β
β 5 β π΅ Draw Layered Circle Mandala β
β Q β β Quit the program β
βββββββ΄βββββββββββββββββββββββββββββββββββββββ
colorsys module)tracer(0) + update() β flicker-free rendering| Concept | Details |
|---|---|
turtle graphics |
Drawing, movement, color, speed |
colorsys HSV |
Smooth rainbow color generation |
math.sin / cos |
Polar coordinates for Rose curve |
| Keyboard events | screen.onkey() bindings |
screen.tracer(0) |
Fast, flicker-free animation |
| Lambda closures | Pattern switching handlers |
| Polar coordinates | Rose & circle calculations |
# HSV se rainbow colors
def set_color_hsv(hue, saturation=0.9, value=1.0):
r, g, b = colorsys.hsv_to_rgb(hue % 1.0, saturation, value)
t.pencolor(r, g, b)
# Rose curve math
r = scale * math.cos(petals * theta)
x = r * math.cos(theta)
y = r * math.sin(theta)
# Keyboard binding
screen.onkey(on_key(petal_mandala), "1")
Pull requests welcome hai! Naya pattern add karna chahte ho? Fork karo aur PR bhejo! π
git checkout -b feature/new-patterngit commit -m 'Add new pattern'git push origin feature/new-pattern.MIT License β freely use, modify, and share! π