2
# -*- coding: cp1252 -*-
3
""" turtle-example-suite:
7
Enhanced clock-program, showing date
9
------------------------------------
10
Press STOP to exit the program!
11
------------------------------------
14
from datetime import datetime
18
def jump(distanz, winkel=0):
25
def hand(laenge, spitze):
36
def make_hand_shape(name, laenge, spitze):
42
hand_form = get_poly()
43
register_shape(name, hand_form)
46
def clockface(radius):
60
global second_hand, minute_hand, hour_hand, writer
62
make_hand_shape("second_hand", 125, 25)
63
make_hand_shape("minute_hand", 130, 25)
64
make_hand_shape("hour_hand", 90, 25)
66
second_hand = Turtle()
67
second_hand.shape("second_hand")
68
second_hand.color("gray20", "gray80")
69
minute_hand = Turtle()
70
minute_hand.shape("minute_hand")
71
minute_hand.color("blue1", "red1")
73
hour_hand.shape("hour_hand")
74
hour_hand.color("blue3", "red3")
75
for hand in second_hand, minute_hand, hour_hand:
76
hand.resizemode("user")
77
hand.shapesize(1, 1, 3)
88
wochentag = ["Monday", "Tuesday", "Wednesday",
89
"Thursday", "Friday", "Saturday", "Sunday"]
90
return wochentag[t.weekday()]
93
monat = ["Jan.", "Feb.", "Mar.", "Apr.", "May", "June",
94
"July", "Aug.", "Sep.", "Oct.", "Nov.", "Dec."]
96
m = monat[z.month - 1]
98
return "%s %d %d" % (m, t, j)
102
sekunde = t.second + t.microsecond*0.000001
103
minute = t.minute + sekunde/60.0
104
stunde = t.hour + minute/60.0
109
writer.write(wochentag(t),
110
align="center", font=("Courier", 14, "bold"))
112
writer.write(datum(t),
113
align="center", font=("Courier", 14, "bold"))
116
second_hand.setheading(6*sekunde)
117
minute_hand.setheading(6*minute)
118
hour_hand.setheading(30*stunde)
129
if __name__ == "__main__":