Analog Clock Program
Analog Clock Program
def movehHand():
currentHourInternal = datetime.datetime.now().hour
degree = (currentHourInternal - 15) * -30
currentMinuteInternal =
datetime.datetime.now().minute degree = degree + -0.5
* currentMinuteInternal hHand.setheading(degree)
window.ontimer(movehHand,
60000) def movemHand():
currentMinuteInternal =
datetime.datetime.now().minute
degree =
(currentMinuteInternal - 15) *
-6 currentSecondInternal =
datetime.datetime.now().second
degree = degree + (-
currentSecondInternal * 0.1)
mHand.setheading(degree)
window.ontimer(movemHand,
1000)
def movesHand():
currentSecondInternal =
datetime.datetime.now().second
degree = (currentSecondInternal
- 15) * -6
sHand.setheading(degree)
window.ontimer(movesHand,
1000)
window.ontimer(movehHand,
window.ontimer(movemHand, 1)
1)
window.ontimer(movesHand,
window.exitonclick() 1)