viernes, 30 de agosto de 2024

draw

 import turtle


# Create a turtle screen

screen = turtle.Screen()

screen.bgcolor("black")  # Set the background color to black


# Create a turtle

spiral_turtle = turtle.Turtle()

spiral_turtle.speed(0)  # Set the turtle speed to maximum (no animation)


# Define colors for the spiral

colors = ["red", "orange", "yellow", "green", "blue", "purple"]


# Draw a colorful spiral pattern

for i in range(360):

    spiral_turtle.pencolor(colors[i % 6])  # Cycle through the colors

    spiral_turtle.forward(i * 3 / len(colors))  # Move the turtle forward

    spiral_turtle.left(59)  # Turn the turtle left


# Hide the turtle and finish

spiral_turtle.hideturtle()


# Keep the window open until it is closed by the user

turtle.done()


No hay comentarios:

Publicar un comentario