Μάθημα : ΠΛΗΡΟΦΟΡΙΚΗ Γ' ΓΥΜΝΑΣΙΟΥ

Κωδικός : 0601053209

0601053209  -  ΙΩΑΝΝΗΣ ΓΚΑΔΟΛΟΣ

Ανακοινώσεις

κώδικας python ANIMATION ΟΜΟΚΕΝΤΡΟΙ ΚΥΚΛΟΙ - ΔΙΑΦΟΡΑ ΧΡΩΜΑΤΑ -FPS

import random
import time
from turtle import *

# Setup screen
screen = Screen()
screen.setup(1080, 1080)
screen.colormode(255)

# Setup turtle
turtle = Turtle()

turtle.speed(0)
turtle.width(33)
turtle.penup()
turtle.hideturtle()

# Set FPS (frames per second)
fps = 100 # Adjust FPS (Lower = Slower)

screen.tracer(0, 0) # Disable automatic updates
screen.delay(0) # Remove execution delay


# Start animation loop
while True:
turtle.goto(0, 0)
turtle.clear()

for i in range(40, 411, 40):
turtle.pencolor(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
turtle.pendown()
turtle.circle(i)

turtle.penup()
turtle.goto(0, -i)

screen.update() # Refresh screen after drawing
time.sleep(1 / fps) # Slow down FPS (10 FPS here)

screen.mainloop() # Keeps the window open (though it's unreachable in the loop)