Skip to content

KanuSaru/python-turtle-leaf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Turtle Leaf Pattern

This is a simple Python program that uses the Turtle Graphics library to draw a leaf-like circular pattern. Each leaf is created using arcs, and the turtle rotates after each one to form a complete shape.


Requirements

  • Python 3.x
  • turtle (included with Python)

How It Works

  1. The program initializes the Turtle environment:

    • Full-screen window
    • Black background
    • White drawing color
    • Moderate pen thickness for smooth lines
  2. It defines a single function:

    • leaf(): Draws a leaf shape by combining two circular arcs connected by a turn.
  3. The main loop:

    • Calls leaf() multiple times (9 by default)
    • Rotates slightly between each iteration to create a radial pattern

Running the Program

Run the script in a Python environment that supports Turtle graphics (such as the standard Python IDLE):

python main.py

Click anywhere on the window to close it when the drawing is finished.


Customization

  • Change the number of leaves:

    for i in range(12):
        leaf()
  • Adjust the angle between leaves inside the leaf() function:

    t.left(60)
  • Modify the color or background:

    t.color("green")
    screen.bgcolor("lightblue")
  • Change leaf curvature by adjusting the circle radius or arc extent:

    t.circle(80, 120)

Example Outputs

Here are some example patterns generated by the program:

Pattern 1

Pattern 1

Pattern 2

Pattern 2

Pattern 3

Pattern 3

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages