猫史档案馆


红石小蝈

红石小蝈

Lv.1

获赞:3收藏:2浏览:20作品收藏:0
回复帖子评论
上一页1 页 / 共 1下一页

创意Python 中回复

我挑了一个短的,然后一缩再缩,勉强50行

import turtle
import time
class hand:
    def __init__(self,lenth,width,color,code):
        self.lenth=lenth
        self.width=width
        self.pen=turtle.Turtle()
        self.pen.color(color)
        self.pen.speed(0)
        self.pen.pensize(width)
        self.code=code
    def run(self):
        t=int(time.time())
        self.pen.home()
        self.pen.clear()
        if self.code==0:t=(t%43200)/120-90
        elif self.code==1:t=(t%3600)/10-90
        else:t=(t%60)*6-90
        self.pen.rt(t)
        self.pen.fd(self.lenth)
class clock:
    def __init__(self,hands,r,color,fillcolor):
        self.hands=hands
        self.r=r
        self.color=color
        self.fillcolor=fillcolor
    def draw(self,pen):
        pen.color(self.color,self.fillcolor)
        pen.speed(0)
        pen.lt(90)
        pen.pu()
        pen.fd(self.r)
        pen.pd()
        pen.begin_fill()
        pen.rt(90)
        for x in range(12):
            pen.circle(-100,30)
            pen.rt(90)
            pen.fd(20)
            pen.write(x+1,font=('comic',20))
            pen.bk(20)
            pen.lt(90)
        pen.end_fill()
    def run(self):
        for h in self.hands:h.run()
c=clock([hand(80,2,'#ee0000',2),hand(70,4,'#00ffcc',1),hand(40,8,'#39c5bb',0)],100,'#0080ff','#66ccff')
T=turtle.Turtle()
c.draw(T)
for x in range(3600):c.run()

2019-05-17T22:07:23 点赞:0

【Python作品分享】maze 中回复

可通过调整倒数第4行的两个数字改变迷宫的大小

 

2019-06-05T22:02:12 点赞:0

【海龟编辑器】意见反馈信箱(长期有效) 中回复

啥时候能把面向对象代码也变成积木啊(来自一名喜欢把代码写成类的同学)

2019-06-07T20:12:48 点赞:0

新人报道,顺便搜索东方project游戏玩家 中回复

www.bilibili.com/video/av106

www.bilibili.com/video/av107

 

2019-06-07T20:17:03 点赞:0