猫史档案馆


创意Python

用户:温柔的草灵灵532温柔的草灵灵532查看:4 回复:4 评论:4 创建时间:2019-05-16T20:35:22


  走过路过不要错过,由鄙人开展的创意Python活动开始啦!!!!!!!!!

  投稿者在评论区发下自己原创的一段代码,不能有先搭积木再让系统翻译的情况。

  投稿者要写注释。

  主题必须原创,不可照抄或借助Kitten上的素材。

  代码行数在15-50行之间。

   主题越新颖越好。

   不能发布违反发帖制度的代码。

   代码必须再三核审,不许发布有错误的代码。

   发布时间:2019年6月1日至8月20日。

  在10月时,鄙人将会发布排行榜:特等奖2名,一等奖3名,二等奖3名,三等奖4名。

   注:此创作活动一年一度

 


回复

上一页1 页 / 共 1下一页
红石小蝈红石小蝈

我挑了一个短的,然后一缩再缩,勉强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()

点赞0


评论


TobylaiTobylai

pyqt4 的可以吗。。。
舍不得给你看代码,打包成exe再给你吧。。。

点赞0


评论


TobylaiTobylai

300行的要不要。。。

点赞0


评论


wwwloadwwwload

我现在发还有希望吗

点赞0


评论