Back to index

python3.2  3.2.2
Functions | Variables
turtledemo.clock Namespace Reference

Functions

def jump
def hand
def make_hand_shape
def clockface
def setup
def wochentag
def datum
def tick
def main

Variables

tuple msg = main()

Function Documentation

def turtledemo.clock.clockface (   radius)

Definition at line 46 of file clock.py.

00046 
00047 def clockface(radius):
00048     reset()
00049     pensize(7)
00050     for i in range(60):
00051         jump(radius)
00052         if i % 5 == 0:
00053             fd(25)
00054             jump(-radius-25)
00055         else:
00056             dot(3)
00057             jump(-radius)
00058         rt(6)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 92 of file clock.py.

00092 
00093 def datum(z):
00094     monat = ["Jan.", "Feb.", "Mar.", "Apr.", "May", "June",
00095              "July", "Aug.", "Sep.", "Oct.", "Nov.", "Dec."]
00096     j = z.year
00097     m = monat[z.month - 1]
00098     t = z.day
00099     return "%s %d %d" % (m, t, j)

Here is the caller graph for this function:

def turtledemo.clock.hand (   laenge,
  spitze 
)

Definition at line 25 of file clock.py.

00025 
00026 def hand(laenge, spitze):
00027     fd(laenge*1.15)
00028     rt(90)
00029     fd(spitze/2.0)
00030     lt(120)
00031     fd(spitze)
00032     lt(120)
00033     fd(spitze)
00034     lt(120)
00035     fd(spitze/2.0)

Here is the caller graph for this function:

def turtledemo.clock.jump (   distanz,
  winkel = 0 
)

Definition at line 18 of file clock.py.

00018 
00019 def jump(distanz, winkel=0):
00020     penup()
00021     right(winkel)
00022     forward(distanz)
00023     left(winkel)
00024     pendown()

Here is the caller graph for this function:

Definition at line 122 of file clock.py.

00122 
00123 def main():
00124     tracer(False)
00125     setup()
00126     tracer(True)
00127     tick()
00128     return "EVENTLOOP"

Here is the call graph for this function:

def turtledemo.clock.make_hand_shape (   name,
  laenge,
  spitze 
)

Definition at line 36 of file clock.py.

00036 
00037 def make_hand_shape(name, laenge, spitze):
00038     reset()
00039     jump(-laenge*0.15)
00040     begin_poly()
00041     hand(laenge, spitze)
00042     end_poly()
00043     hand_form = get_poly()
00044     register_shape(name, hand_form)
00045 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 59 of file clock.py.

00059 
00060 def setup():
00061     global second_hand, minute_hand, hour_hand, writer
00062     mode("logo")
00063     make_hand_shape("second_hand", 125, 25)
00064     make_hand_shape("minute_hand",  130, 25)
00065     make_hand_shape("hour_hand", 90, 25)
00066     clockface(160)
00067     second_hand = Turtle()
00068     second_hand.shape("second_hand")
00069     second_hand.color("gray20", "gray80")
00070     minute_hand = Turtle()
00071     minute_hand.shape("minute_hand")
00072     minute_hand.color("blue1", "red1")
00073     hour_hand = Turtle()
00074     hour_hand.shape("hour_hand")
00075     hour_hand.color("blue3", "red3")
00076     for hand in second_hand, minute_hand, hour_hand:
00077         hand.resizemode("user")
00078         hand.shapesize(1, 1, 3)
00079         hand.speed(0)
00080     ht()
00081     writer = Turtle()
00082     #writer.mode("logo")
00083     writer.ht()
00084     writer.pu()
00085     writer.bk(85)
00086 

Here is the call graph for this function:

Definition at line 100 of file clock.py.

00100 
00101 def tick():
00102     t = datetime.today()
00103     sekunde = t.second + t.microsecond*0.000001
00104     minute = t.minute + sekunde/60.0
00105     stunde = t.hour + minute/60.0
00106     tracer(False)
00107     writer.clear()
00108     writer.home()
00109     writer.forward(65)
00110     writer.write(wochentag(t),
00111                  align="center", font=("Courier", 14, "bold"))
00112     writer.back(150)
00113     writer.write(datum(t),
00114                  align="center", font=("Courier", 14, "bold"))
00115     writer.forward(85)
00116     tracer(True)
00117     second_hand.setheading(6*sekunde)
00118     minute_hand.setheading(6*minute)
00119     hour_hand.setheading(30*stunde)
00120     tracer(True)
00121     ontimer(tick, 100)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 87 of file clock.py.

00087 
00088 def wochentag(t):
00089     wochentag = ["Monday", "Tuesday", "Wednesday",
00090         "Thursday", "Friday", "Saturday", "Sunday"]
00091     return wochentag[t.weekday()]

Here is the caller graph for this function:


Variable Documentation

Definition at line 130 of file clock.py.