$69 GRAYBYTE WORDPRESS FILE MANAGER $53

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/lib64/python3.12/turtledemo/

HOME
Current File : /lib64/python3.12/turtledemo//clock.py
#! /usr/bin/python3.12
"""       turtle-example-suite:

           turtledemo/clock.py

Enhanced clock-program, showing date
and time
  ------------------------------------
   Press STOP to exit the program!
  ------------------------------------
"""
from turtle import *
from datetime import datetime

dtfont = "TkFixedFont", 14, "bold"
current_day = None

def jump(distanz, winkel=0):
    penup()
    right(winkel)
    forward(distanz)
    left(winkel)
    pendown()

def hand(laenge, spitze):
    fd(laenge*1.15)
    rt(90)
    fd(spitze/2.0)
    lt(120)
    fd(spitze)
    lt(120)
    fd(spitze)
    lt(120)
    fd(spitze/2.0)

def make_hand_shape(name, laenge, spitze):
    reset()
    jump(-laenge*0.15)
    begin_poly()
    hand(laenge, spitze)
    end_poly()
    hand_form = get_poly()
    register_shape(name, hand_form)

def clockface(radius):
    reset()
    pensize(7)
    for i in range(60):
        jump(radius)
        if i % 5 == 0:
            fd(25)
            jump(-radius-25)
        else:
            dot(3)
            jump(-radius)
        rt(6)

def display_date_time():
    global current_day
    writer.clear()
    now = datetime.now()
    current_day = now.day
    writer.home()
    writer.forward(distance=65)
    writer.write(wochentag(now), align="center", font=dtfont)
    writer.back(distance=150)
    writer.write(datum(now), align="center", font=dtfont)
    writer.forward(distance=85)

def setup():
    global second_hand, minute_hand, hour_hand, writer
    mode("logo")
    make_hand_shape("second_hand", 125, 25)
    make_hand_shape("minute_hand",  115, 25)
    make_hand_shape("hour_hand", 90, 25)
    clockface(160)
    second_hand = Turtle()
    second_hand.shape("second_hand")
    second_hand.color("gray20", "gray80")
    minute_hand = Turtle()
    minute_hand.shape("minute_hand")
    minute_hand.color("blue1", "red1")
    hour_hand = Turtle()
    hour_hand.shape("hour_hand")
    hour_hand.color("blue3", "red3")
    for hand in second_hand, minute_hand, hour_hand:
        hand.resizemode("user")
        hand.shapesize(1, 1, 3)
        hand.speed(0)
    ht()
    writer = Turtle()
    writer.ht()
    writer.pu()
    writer.bk(85)
    display_date_time()

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

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

def tick():
    t = datetime.today()
    sekunde = t.second + t.microsecond*0.000001
    minute = t.minute + sekunde/60.0
    stunde = t.hour + minute/60.0
    try:
        tracer(False)  # Terminator can occur here
        second_hand.setheading(6*sekunde)  # or here
        minute_hand.setheading(6*minute)
        hour_hand.setheading(30*stunde)
        if t.day != current_day:
            display_date_time()
        tracer(True)
        ontimer(tick, 100)
    except Terminator:
        pass  # turtledemo user pressed STOP

def main():
    tracer(False)
    setup()
    tracer(True)
    tick()
    return "EVENTLOOP"

if __name__ == "__main__":
    mode("logo")
    msg = main()
    print(msg)
    mainloop()

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
9 Dec 2025 9.24 PM
root / root
0755
__pycache__
--
9 Dec 2025 9.24 PM
root / root
0755
__init__.py
0.307 KB
3 Jun 2025 10.41 PM
root / root
0644
__main__.py
15.015 KB
3 Jun 2025 10.41 PM
root / root
0755
bytedesign.py
4.148 KB
3 Jun 2025 10.41 PM
root / root
0755
chaos.py
0.929 KB
3 Jun 2025 10.41 PM
root / root
0644
clock.py
3.227 KB
3 Jun 2025 10.41 PM
root / root
0755
colormixer.py
1.308 KB
3 Jun 2025 10.41 PM
root / root
0644
forest.py
2.896 KB
3 Jun 2025 10.41 PM
root / root
0755
fractalcurves.py
3.392 KB
3 Jun 2025 10.41 PM
root / root
0755
lindenmayer.py
2.377 KB
3 Jun 2025 10.41 PM
root / root
0755
minimal_hanoi.py
2.003 KB
3 Jun 2025 10.41 PM
root / root
0755
nim.py
6.36 KB
3 Jun 2025 10.41 PM
root / root
0644
paint.py
1.261 KB
3 Jun 2025 10.41 PM
root / root
0755
peace.py
1.041 KB
3 Jun 2025 10.41 PM
root / root
0755
penrose.py
3.301 KB
3 Jun 2025 10.41 PM
root / root
0755
planet_and_moon.py
2.759 KB
3 Jun 2025 10.41 PM
root / root
0755
rosette.py
1.329 KB
3 Jun 2025 10.41 PM
root / root
0644
round_dance.py
1.762 KB
3 Jun 2025 10.41 PM
root / root
0644
sorting_animate.py
4.935 KB
3 Jun 2025 10.41 PM
root / root
0755
tree.py
1.368 KB
3 Jun 2025 10.41 PM
root / root
0755
turtle.cfg
0.156 KB
3 Jun 2025 10.41 PM
root / root
0644
two_canvases.py
1.093 KB
3 Jun 2025 10.41 PM
root / root
0644
yinyang.py
0.802 KB
3 Jun 2025 10.41 PM
root / root
0755

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF