Open In App
Related Articles

How to draw color filled star in Python-Turtle?

Improve Article
Save Article
Like Article

Prerequisite: Turtle Programming Basics, Draw Color Filled Shapes in Turtle

Turtle is an inbuilt module in Python. It provides drawing using a screen (cardboard) and turtle (pen). To draw something on the screen, we need to move the turtle (pen). To move the turtle, there are some functions i.e forward(), backward(), etc.


The following steps are used:

  • Import turtle
  • Set window screen
  • Set color of the turtle
  • Form a star
  • Fill the star with the color

Below is the implementation.


# importing package
import turtle
# function to draw
# colored star
def colored_star():
    # size of star
    size = 80
    # object color
    # object width
    # angle to form star
    angle = 120
    # color to fill
    # form star
    for side in range(5):
        turtle.right(72 - angle)
    # fill color
# Driver code


Output :


Since, as of now, you must have learned how to draw and fill color in a star. So, let’s try something unique with this knowledge. Let’s use some creativity and programming to build a night full of stars.


import turtle
from random import randint
window = turtle.Screen()
def draw_star():
    turns = 6
    while turns>0:
        turns = turns-1
nums_stars = 0
while nums_stars <50:
    nums_stars = nums_stars + 1


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 08 Oct, 2020
Like Article
Save Article
Similar Reads
Related Tutorials