Learn to Code via Tutorials on Repl.it!

← Back to all posts
Spirograph tutorial.
CoolPanda123 (2)

Hello everyone! this is my tutorial on how to create a Spirograph in Python(with Turtle).

from turtle import *
pensize(2)
speed(0)
d = Screen()
d.bgcolor("black")
for i in range(6):
  for colors in ["red","blue","magenta","green","yellow","white"]:
    circle(100)
    left(10)
    color(colors)

Glossary:
from turtle import * : This line says to python to import everything from the turtle module.
pensize : is the size of your pen.
speed : is the speed of the turtle.
d : is a variable that I used.
Screen() : it can be used to change the background color of the turtle.
bgcolor : I used this to change the background color.
for i in range(): : is used to loop something for a certain amount of times.
for colors in ["red","blue","magenta","green","yellow","white"]: : for changing the color of the turtle.
circle : used to make a circle in turtle.
left : used to move left a certain amount of degrees.
color(colors) : changes the color to the colors in ["red","blue","magenta","green","yellow","white"].

Thank You!

Comments
hotnewtop
LilyHALTON (0)

Won't work? Any advice?