import turtle import datetime import time #Setup turtle.ht() turtle.tracer(0) turtle.speed(0) #Definition der Kreise def circles(fill): turtle.pu() turtle.bk(20) turtle.pd() if fill == 0: turtle.circle(10) else: turtle.begin_fill() turtle.circle(10) turtle.end_fill() turtle.pu() turtle.home() turtle.pu() turtle.bk(25) #Postitionieren der Turtle def distance(pixels): turtle.home() turtle.pu() turtle.lt(90) turtle.bk(pixels) turtle.rt(90) #Berechnen der einzelnen Stellen def main(): turtle.clear() turtle.home() h = datetime.datetime.now().hour min = datetime.datetime.now().minute sec = datetime.datetime.now().second hr_pos2 = h//2 mn_pos2 = min//2 sk_pos2 = sec//2 for i in range(6): hr_pos2 = hr_pos2 // 2 hr_pos = hr_pos2 % 2 circles(hr_pos) distance(50) for i in range(7): mn_pos2 = mn_pos2 // 2 mn_pos = mn_pos2 % 2 circles(mn_pos) distance(100) for i in range(7): sk_pos2 = sk_pos2 // 2 sk_pos = sk_pos2 % 2 circles(sk_pos) turtle.update() #Ausführen while True: main() time.sleep(0.1)