turtle模拟时钟_面向对象_TimePointer类

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

from turtle import *
from time import *

def init_screen():
    
    screen = Screen()
    screen.title("模拟时钟_python海龟画图模块制作_by_李兴球")
    screen.delay(0)
    screen.mode("logo")     #此模式刚好和时钟转动相适配
    pointer = ((0,0),(5,0),(5,50),(10,50),(0,60),(-10,50),(-5,50),(-5,0)) #顶点表
    screen.addshape("pointer",pointer)                        #添加大箭头各顶点到形状列表
    
    return screen
    
def draw_digital():
    
    #以下代码画时钟的数字
    radius = 300
    draw_turtle = Turtle(visible=False,shape='circle')

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

       

You must log in to read the rest of this article. Please log in or register as a user.