---
# System prepended metadata

title: clock

---

# clock
```
#python clock
import turtle, time, datetime

def clock(Hour,Minute,Second):
    t1 = turtle.Turtle()
    t1.color("red") #pointer color

    t1.penup() #draw hour hand
    t1.goto(0,0)
    t1.setheading(90) #Point to the top - 12 o'clock
    t1.right(Hour*360/12)
    t1.pendown()
    t1.forward(100)

    t1.penup() #draw minute hand
    t1.goto(0,0)
    t1.setheading(90) # Point to the top - 0 minute
    t1.right(Minute*360/60)
    t1.pendown()
    t1.forward(150)

    t1.penup() #draw second hand
    t1.goto(0,0)
    t1.setheading(90) # Point to the top - 0 minute
    t1.right(Second*360/60)
    t1.pendown()
    t1.forward(200)

    t1.getscreen().update()
    t1.hideturtle()
    t1.clear()
    time.sleep(1)

r = 210
t = turtle.Turtle()
#t.shape("arrow")
turtle.tracer(0)
t.speed(0)

#t.penup() #move turtle in air
#t.goto(0,-r)

#t.pendown() #move turtle to surface
#t.color("blue") #circumference color
#t.circle(r)

t.penup() #move turtle in air
t.goto(-5,r+15)
v = 0
for i in range(12):
    v += 1
    t.setheading(-30 * (i + 3) + 75)  # for circular motion
    t.forward(100)  # move forward for space

    #t.pendown()  # move turtle to surface
    #t.forward(93)  # move forward for dash line

    t.penup()
    t.forward(20)  # move forward for space
    t.write(str(v), font=("Arial", 12, "normal"))
t.hideturtle()

#turtle.done()

M = datetime.datetime.now().minute
H = datetime.datetime.now().hour
S = datetime.datetime.now().second
#currentMinute=48
#currentHour=2
a,a1 = 1/60,1/3600
M += S*a
H += M*a
for i in range(3600):
    clock(H,M,S)
    S += 1
    M += a
    H += a1

```
![](https://i.imgur.com/IoTMJOB.jpg)
