Basic Python Turtle Code: Orbit

Publié le: 31 mai 2022
sur la chaîne: Basic Python Turtle Art
208
1

Stamped images of an orbiting planet set against a yellow-to-blue gradient.

Feel free to copy and paste the basic Python Turtle code that is given below. Ask questions about the code if you have any. Please enjoy, like, and subscribe! :)

import turtle
t = turtle.Turtle()
screen = turtle.Screen()
screen.tracer(False)
color1 = (1, 1, 0)
color2 = (0, 0, 1)
w, h = screen.window_width(), screen.window_height()
delt = [(red - color1[i]) / h for i, red in enumerate(color2)]
t.color(color1)
t.penup()
t.goto(-w/2, h/2)
t.pendown()
sign = 1
for distance, y in enumerate(range(h//2, -h//2, -1)):
t.forward(w * sign)
t.color([color1[i] + delta * distance for i, delta in enumerate(delt)])
t.sety(y)
sign *= -1
screen.tracer(True)
t.right(113)
rad = 20
for i in range(7):
t.penup()
t.goto(-150, 250)
t.forward(450)
t.fillcolor(1, 1, 1)
t.begin_fill()
t.circle(rad)
t.end_fill()
rad += 5
t.left(rad / 2.6)
t.ht()
screen.exitonclick()


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