Draw a Flower Using Python Turtle

Galactic Flower Using Python Turtle

Introduction

The principles are required to draw any forms using Python Turtle, in this case, we will be drawing a very simple Galactic Flower Using Python Turtle. If you think about it, our galactic flower just circles (of various forms and colors) drawn in a non-overlapping pattern.

The turtle has three qualities: a location, an orientation (or direction), and a pen. The pen’s attributes include color, width, and on/off state (also called down and up).

The turtle responds to directions such as “go ahead 10 spaces” and “turn left 90 degrees” based on its present location. You can also control the turtle’s pen by activating it, altering its color, and modifying its breadth. A student can comprehend (and foresee and reason about) the turtle’s movement by picturing what they would do if they were the turtle.

Step 1. We are just importing the Python turtle library below.

import turtle
window = turtle.Screen()
window.bgcolor('black')
window.title("Galactic Flower made for Follow Tutorials")

First of all, we import the library, and then set the background color and set the Title.

Step 2. Create 2nd Instance.

galatic = turtle.Turtle()
galatic.speed(2)
galatic.color('white')

Create a turtle object and assign it a preferred speed and color, in this case, white and speed 2.

Step 3. Assigning 180 as an integer to rotate.

rotate=int(180)

Step 4. Define Circles function

def Circles(t,size):
    for i in range(10):
        t.circle(size)
        size=size-4

Step 5. Define 2nd drawCircles function

def drawCircles(t,size,repeat):
  for i in range (repeat):
    Circles(t,size)
    t.right(360/repeat)

Complete Code to Draw a Galactic Flower Using Python Turtle

import turtle

window = turtle.Screen()
window.bgcolor('black')
window.title("Galactic Flower made for Follow Tutorials")

galatic = turtle.Turtle()
galatic.speed(20)
galatic.color('white')

rotate=int(180)

def Circles(t,size):
    for i in range(10):
        t.circle(size)
        size=size-4

def drawCircles(t,size,repeat):
  for i in range (repeat):
    Circles(t,size)
    t.right(360/repeat)

drawCircles(galatic,150,10)

t1 = turtle.Turtle()
t1.speed(20)
t1.color('yellow')

rotate=int(90)

def Circles(t,size):
    for i in range(4):
        t.circle(size)
        size=size-10

def drawCircles(t,size,repeat):
    for i in range (repeat):
        Circles(t,size)
        t.right(360/repeat)
drawCircles(t1,130,10)
t2= turtle.Turtle()
t2.speed(20)
t2.color('blue')

rotate=int(80)

def Circles(t,size):
    for i in range(4):
        t.circle(size)
        size=size-5

def drawCircles(t,size,repeat):
    for i in range (repeat):
        Circles(t,size)
        t.right(360/repeat)

drawCircles(t2,110,10)
t3 = turtle.Turtle()
t3.speed(20)
t3.color('red')

rotate=int(90)

def Circles(t,size):
    for i in range(4):
        t.circle(size)
        size=size-19

def drawCircles(t,size,repeat):
    for i in range (repeat):
        Circles(t,size)
        t.right(360/repeat)

drawCircles(t3,80,10)
t4= turtle.Turtle()
t4.speed(20)
t4.color('green')

rotate=int(90)

def Circles(t,size):
    for i in range(4):
        t.circle(size)
        size=size-20

def drawCircles(t,size,repeat):
    for i in range (repeat):
        Circles(t,size)
        t.right(360/repeat)

drawCircles(t4,40,10)

turtle.done()

Output:

output Galactic Flower Using Python Turtle

Keep visiting the website for more articles on different python topics.

Thank you for reading this article.


Also Read:

Share:

Author: Ayush Purawr