### turtle模拟时钟程序_函数

```"""这是一个用海龟模块制作的模拟时钟程序,作者:李兴球,日期:2018/12/10于杭州"""

from turtle import *
from time import *

def init_screen():

screen = Screen()
screen.title("模拟时钟")
screen.delay(0)
screen.mode("logo")                                       # 此模式刚好和时钟转动相适配
pointer = ((0,0),(5,0),(5,50),(10,50),(0,60),(-10,50),(-5,50),(-5,0)) #顶点表

return screen

def draw_digital():

#以下代码画时钟的数字
draw_turtle = Turtle(visible=False,shape='circle')

draw_turtle.penup()
for i in range(1,13):
draw_turtle.write(str(i),align="center",font=(None,18,"normal"))
draw_turtle.right(30)
draw_turtle.showturtle()

def run_hour():
"""时钟指针"""
hour = localtime(time()).tm_hour
hour = hour % 12
minute = localtime(time()).tm_min
second = localtime(time()).tm_sec
angle =  hour * 360/12  + (minute * 360/60 ) /12
angle = angle % 360
turtle_hour.screen.ontimer(run_hour,60000)

def run_minute():
"""分钟指针"""
minute = localtime(time()).tm_min
angle =   minute * 360/60
angle = angle % 360
turtle_minute.screen.ontimer(run_minute,1000)

def run_second():
"""秒钟指针"""
second = localtime(time()).tm_sec
angle =  second * 360/60
angle = angle % 360