Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
27 views1 page

Python Star

The document contains a Python script using the turtle graphics library to draw a series of stars. It sets up a turtle with specific pen colors and sizes, and iteratively draws stars with increasing sizes while incorporating pauses and clearing the screen. The turtle's visibility is toggled throughout the drawing process.

Uploaded by

Jozu the Great
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views1 page

Python Star

The document contains a Python script using the turtle graphics library to draw a series of stars. It sets up a turtle with specific pen colors and sizes, and iteratively draws stars with increasing sizes while incorporating pauses and clearing the screen. The turtle's visibility is toggled throughout the drawing process.

Uploaded by

Jozu the Great
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import turtle

import time

star = turtle.Turtle() #t = turtle.Turtle()


star.pen(pencolor="blue", pensize=5, speed=3) #t.pen
bg = turtle.Screen() #background
bg.bgcolor("light green") #t.bgcolor("green")
star.shape("arrow") #t.shape("star") >> only shapes available
# square, arrow, circle,
# turtle, triangle, classic
fw = 50
for x in range(10):
for i in range(5):
star.forward(fw)
star.right(144)

fw = fw + 20
star.hideturtle() #hides turtle(or any other shape)
star.up() #pull up pen (no drawing unless after using pen.down)
star.clear() #clear all turtle drawing
time.sleep(2) #delay time (in seconds)
star.pendown() #puts down pen

You might also like