import turtle
import time
# Create a turtle object
t = turtle.Turtle()
# Set turtle speed
t.speed(0)
# Define colors
colors = ["red", "orange", "yellow", "green", "blue", "indigo", "violet"]
# Set starting position
x, y = -200, 0
# Function to toggle colors
def toggle_colors():
for color in colors:
t.clear()
t.penup()
t.goto(x, y)
t.pendown()
t.color(color)
t.write("raja", font=("Arial", 100, "bold"))
time.sleep(0.5) # Delay for 0.5 seconds
# Blink the text in different colors
while True:
toggle_colors()
No comments:
Post a Comment