1024,晒出程序猿的小浪漫
不知不觉,从 6.0 设计器发布以来,旗旗陪我们度过了一段美好时光,趁着 1024 给旗旗准备了一份小惊喜。
下面会贴出源码
import turtle, time
def drawGap(): #绘制数码管间隔
turtle.penup()
turtle.fd(5)
def drawLine(draw): #绘制单段数码管
drawGap()
turtle.pendown() if draw else turtle.penup()
turtle.fd(40)
drawGap()
turtle.right(90)
def drawDigit(d): #根据数字绘制七段数码管
drawLine(True) if d in [2,3,4,5,6,8,9] else drawLine(False)
drawLine(True) if d in [0,1,3,4,5,6,7,8,9] else drawLine(False)
drawLine(True) if d in [0,2,3,5,6,8,9] else drawLine(False)
drawLine(True) if d in [0,2,6,8] else drawLine(False)
turtle.left(90)
drawLine(True) if d in [0,4,5,6,8,9] else drawLine(False)
drawLine(True) if d in [0,2,3,5,6,7,8,9] else drawLine(False)
drawLine(True) if d in [0,1,2,3,4,7,8,9] else drawLine(False)
turtle.left(180)
turtle.penup()
turtle.fd(20)
def drawDate(date):
turtle.pencolor("red")
for i in date:
if i == '-':
turtle.write('年',font=("Arial", 18, "normal"))
turtle.pencolor("green")
turtle.fd(40)
elif i == '=':
turtle.write('月',font=("Arial", 18, "normal"))
turtle.pencolor("blue")
turtle.fd(40)
elif i == '+':
turtle.write('日',font=("Arial", 18, "normal"))
turtle.fd(40)
else:
drawDigit(eval(i))
def all(day):
turtle.goto(-350,-300)
turtle.pencolor("orange")
turtle.write('总共',font=("Arial", 40, "normal"))
turtle.fd(110)
for j in day:
drawDigit(eval(j))
turtle.write('天',font=("Arial", 18, "normal"))
def count(t1,t2,t3):
t=t1*365
if t2 in [1,2]:
t+=t2*30
if t2 in [3]:
t=t+91
if t2==4:
t+=122
if t2==5:
t+=152
if t2==6:
t+=183
if t2==7:
t+=213
if t2==8:
t+=244
if t2==9:
t+=275
if t2==10:
t+=303
if t2==11:
t+=334
t+=t3
return(str(t))
def text():
turtle.penup()
turtle.goto(-350,370)
turtle.pendown()
turtle.write('今天是:',font=("Arial", 18, "normal"))
turtle.pensize(5)
turtle.penup()
turtle.goto(-350,300)
turtle.pendown()
drawDate(time.strftime('%Y-%m=%d+',time.gmtime()))
turtle.penup()
turtle.goto(-350,200)
turtle.pensize(1)
turtle.pendown()
turtle.pencolor("black")
turtle.write('和iS-RPA旗旗在一起:(6.0发布)',font=("Arial", 18, "normal"))
turtle.penup()
turtle.goto(-350,100)
turtle.pendown()
turtle.pensize(5)
drawDate('2018-07=19+')
turtle.penup()
turtle.goto(-350,0)
turtle.pensize(1)
turtle.pendown()
turtle.pencolor("black")
turtle.write('我们一起经历了:',font=("Arial", 18, "normal"))
turtle.penup()
turtle.goto(0,-100)
turtle.pensize(1)
turtle.pendown()
def main():
turtle.setup(900, 900, 200, 0)
text()
turtle.penup()
turtle.fd(-350)
turtle.pensize(5)
t1=time.gmtime()
t2=t1.tm_year-2018
t3=t1.tm_mon-2
if t3<0:
t2-=1
t3+=12
t4=t1.tm_mday-23
if t4<0:
t3-=1
if t1.tm_mon-1 in [1,3,5,7,8,10,12]:
t4+=31
else:
t4+=30
tatol=count(t2,t3,t4)
drawDate(str(t2)+'-'+str(t3)+'='+str(t4)+'+')
all(tatol)
turtle.hideturtle()
turtle.done()
main()
代码中的文本可以随意修改哦,有对象的小哥哥赶紧拿去给女朋友吧
这个必须点赞👍
已贴
你那个应用,贴一下本帖的链接,说明视频效果见社区,大家可以看效果
这个可以有哒
嘻嘻
赶快发布个应用是正经事 ,不过应用应该允许传个名字,然后和女友说:看,我的工作就是干这个
参数建议:和女友相遇的日子,女友名字,其他套用你这个模版就行了
不过看看和 iS-RPA 一起走过的日子,感觉你这个作品真的有才!感动!
优秀,你怎么那么优秀 💕
我觉得应该加个选择,如何设置背景或者添加背景图片,这样用户体验会更好