Basic Python Turtle Code: Tube

Опубликовано: 19 Март 2026
на канале: Basic Python Turtle Art
326
7

A series of circles, any one of which is slightly bigger than the immediately preceding circle. The color also transitions from yellow, to orange, to red, and to violet.

Please feel free to copy and paste the basic Python Turtle code that is given below. Don't hesitate to ask questions about the code if you have any. Please enjoy and subscribe! :)

import turtle
t = turtle.Turtle()
screen = turtle.Screen()
screen.colormode(255)
t.speed(10)
rad = 90
x = -315
g = 255
b = 0
t.pensize(4)
for i in range(31):
t.penup()
t.goto(x, -rad)
t.pendown()
t.pencolor(255, g, b)
t.circle(rad, 360)
rad += 5
x += 15
if g == 0:
b += 17
else:
g -= 17
t.ht()
screen.exitonclick()