import math
import datetime

r = 40

Circle(x = 50, y = 50, width=2*r, height=2*r, color='black')
Circle(x = 50, y = 50, width=2*r-2, height=2*r-2, color='white')

def Hand(angle, length):
    sx = 50
    sy = 50
    ex = 50 + length * math.cos(angle) 
    ey = 50 - length * math.sin(angle)
    Line(points = [sx, sy, ex, ey], color = 'black')

def Tick(hour):
    angle = (.5 - hour / 6) * math.pi + .01
    sx = 50 + (r - 3) * math.cos(angle) 
    sy = 50 - (r - 3) * math.sin(angle)
    ex = 50 + r * math.cos(angle) 
    ey = 50 - r * math.sin(angle)
    Line(points = [sx, sy, ex, ey], color = 'black')

for hour in range(12):
	Tick(hour)
    
time = datetime.datetime.now().time()
hour = time.hour
min  = time.minute

Hand((.5 - hour / 6) * math.pi + .01, .55 * r)
Hand((.5 - min / 30) * math.pi + .01, .8 * r)

Current Time

by ludwik

Created 5 years, 2 months ago.
Based on Clock by xxthe_drama_llamaxx.