python-turtle-mandala

🌸 Mandala Pattern Generator

A colorful, interactive generative art project built with Python’s built-in turtle module β€” no pip installs needed!


        ✦ ── ✦ ── ✦
      β•±               β•²
    ✦   🌸 MANDALA 🌸   ✦
      β•²               β•±
        ✦ ── ✦ ── ✦

πŸ“Œ About

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!


πŸ–ΌοΈ Patterns

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

πŸš€ How to Run

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!


πŸ“ File Structure

mandala-generator/
β”‚
└── mandala.py        # All 5 patterns + keyboard controls + menu

Yeh ek single-file project hai β€” sab kuch ek hi file mein! 🎯


⌨️ Controls

β”Œβ”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 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                  β”‚
β””β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Features


🧠 Concepts Covered

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

πŸ” How It Works

# 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")

🀝 Contributing

Pull requests welcome hai! Naya pattern add karna chahte ho? Fork karo aur PR bhejo! πŸš€

  1. Fork the project
  2. Create your branch: git checkout -b feature/new-pattern
  3. Commit: git commit -m 'Add new pattern'
  4. Push: git push origin feature/new-pattern.
  5. Open a Pull Request

πŸ“„ License

MIT License β€” freely use, modify, and share! 🌍


Made by piyushSoni using Python `turtle` · `colorsys` · `math` ⭐ **Star this repo agar pasand aaya!** ⭐