象棋爱好者 发表于 2022-12-7 17:35:10

钟表

from turtle import*
import datetime
mode('logo')
r=200
speed(30)
pensize(8)
tracer(False)
for i in range(0,60):
    penup()
    forward(r)
    pendown()
    if i%5==0:
      forward(20)
      forward(-20)
    dot(8)
    penup()
    forward(-r)
    left(6)
tracer(True)
pendown()
begin_poly()
forward(-0.1*150)
forward(1.1*150)
end_poly()

register_shape('myturtle',get_poly())
a2=Turtle('myturtle')
a2.shapesize(1.2,2,2)
a2.color('red','yellow')

a1=Turtle('turtle')

a3=Turtle('myturtle')
a3.shapesize(1,2,2)
a3.color('blue','purple')

a4=Turtle('myturtle')
a4.shapesize(0.8,2,2)
a4.color('green','pink')

#a1.forward(100)
t=(datetime.datetime.today())
t4=t.hour
t3=t.minute
t2=t.second
while True:
    a1.left(0.775)
    a2.setheading(t2*6)
    a3.setheading(t3*6)
    a4.setheading(t4*6)
页: [1]
查看完整版本: 钟表