用户:
小复合不在线查看:0 回复:1 评论:0 创建时间:2021-01-31T15:50:52
【作品展示】

【作品介绍】
我的作品非常非常简单,但非常非常有用,运用了变量,大家可以给一些建议,我会越来越好的
【作品源代码】
name = "编程猫"
age = "无知"
hobby = "学python"
print("姓名:", name)
print("年龄:", age)
print("爱好:", hobby)
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn
全員惡人彡清昼加油,小老弟,送你段代码,看看时间吧
import turtle from datetime import * def skip(step): turtle.penup() turtle.forward(step) turtle.pendown() def mkHand(name,lendth): turtle.reset() skip(-lendth*0.1) turtle.begin_poly() turtle.forward(lendth*1.1) turtle.end_poly() handFrom=turtle.get_poly() turtle.register_shape(name,handFrom) def init(): global secHand,minHand,houHand,printer turtle.mode("logo") mkHand("secHand", 135) mkHand("minHand", 125) mkHand("houHand", 90) secHand=turtle.Turtle() secHand.shape("secHand") minHand=turtle.Turtle() minHand.shape("minHand") houHand=turtle.Turtle() houHand.shape("houHand") for hand in secHand,minHand,houHand: hand.shapesize(1,1,3) hand.speed(0) printer=turtle.Turtle() printer.hideturtle() printer.penup() def setupClock(radius): turtle.reset() turtle.pensize(7) for i in range(60): skip(radius) if i%5==0: turtle.forward(20) skip(-radius-20) skip(radius+20) if i==0: turtle.write(int(12),align="center",font=("Courier",14,"bold")) elif i==30: skip(25) turtle.write(int(i/5),align="center",font=("Courier",14,"bold")) skip(-25) elif (i==25 or i==35): skip(20) turtle.write(int(i/5),align="center",font=("Courier",14,"bold")) skip(-20) else: turtle.write(int(i/5),align="center",font=("Courier",14,"bold")) skip(-radius-20) else: turtle.dot(5) skip(-radius) turtle.right(6) def week(t): week=["星期一","星期二","星期三","星期四","星期五","星期六","星期日"] return week[t.weekday()] def date(t): y = t.year m = t.month d = t.day return "%s %d%d" % (y, m, d) def tick(): t = datetime.today() second = t.second + t.microsecond * 0.000001 minute = t.minute + second / 60.0 hour = t.hour + minute / 60.0 secHand.setheading(6 * second) minHand.setheading(6 * minute) houHand.setheading(30 * hour) turtle.tracer(False) printer.forward(65) printer.write(week(t), align="center", font=("Courier", 14, "bold")) printer.back(130) printer.write(date(t), align="center", font=("Courier", 14, "bold")) printer.home() turtle.tracer(True) turtle.ontimer(tick, 100) def main(): turtle.tracer(False) init() setupClock(160) turtle.tracer(True) tick() turtle.mainloop() if __name__ == "__main__": main()
点赞0
评论