Python Turtle Code: Filled Circles

Publié le: 02 février 2022
sur la chaîne: Basic Python Turtle Art
163
1

A classic spirograph of circles in the middle surrounded by small, color-filled ones. The Python Turtle code uses two loops: one for the classic spirograph in the middle and the other for the color-filled ones at the edge.

Please feel free to copy and paste the code below. Feel free, too, to ask questions, if you have any, about the code. Enjoy!
import turtle
scrin = turtle.Screen()
scrin.bgcolor("pink")
t = turtle.Turtle()
t.hideturtle()
t.pensize(6)
t.speed(6)
for i in range(18): #for the classic spirograph of circles at the center
t.circle(100)
t.left(20)
t.penup()
for j in range(6): #for the 6 groups of multicolored circles at the edge
for k in ["red", "green", "blue"]: #each group is composed of three small circles with these colors
t.forward(200)
t.right(90)
t.pendown()
t.fillcolor(k) #color-filling procedure starts here
t.begin_fill()
t.circle(25)
t.end_fill() #color-filling procedure ends here
t.penup()
t.goto(0, 0)
t.left(110) #to orient the turtle correctly before drawing a circle at the edge
scrin.exitonclick()


Sur cette page du site, vous pouvez voir la vidéo en ligne Python Turtle Code: Filled Circles durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Basic Python Turtle Art 02 février 2022, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 163 fois et il a aimé 1 téléspectateurs. Bon visionnage!