标签:popline False 绘制 30 else 数码管 fd True
import turtle as t import time def popspace(): #单管间隔 t.penup() t.fd(5) def popline(draw): #画数码管 popspace() t.pendown() if draw else t.penup() t.fd(40) popspace() t.right(90) def popstart(d): #画数字数码管 popline(True) if d in [2,3,4,5,6,8,9] else popline(False) popline(True) if d in [0,1,3,4,5,6,7,8,9] else popline(False) popline(True) if d in [0,2,3,5,6,8,9] else popline(False) popline(True) if d in [0,2,6,8] else popline(False) t.left(90) popline(True) if d in [0,4,5,6,8,9] else popline(False) popline(True) if d in [0,2,3,5,6,7,8,9] else popline(False) popline(True) if d in [0,1,2,3,4,7,8,9] else popline(False) t.left(180) t.penup() t.fd(30) def popdate(date): t.pencolor((1,0.36,0.28)) t.speed(9) for i in date: if i == '-': t.write('年',font=("Arial", 30, "normal")) t.pencolor((0.93,0.51,0.93)) t.fd(60) elif i == '=': t.write('月',font=("Arial", 30, "normal")) t.pencolor((0.5,0.5,0)) t.fd(60) elif i == '+': t.write('日',font=("Arial", 30, "normal")) t.pencolor((0.25,0.88,0.82)) t.fd(40) #换行输出 t.seth(-90) t.fd(100) t.seth(180) t.fd(700) t.seth(-90) t.fd(40) t.seth(0) t.fd(40) elif i == '*': t.write('时',font=("Arial", 30, "normal")) t.pencolor((0.18,0.55,0.34)) t.fd(60) elif i == '/': t.write('分',font=("Arial", 30, "normal")) t.pencolor((1,0.89,0.77)) t.fd(60) elif i == '!': t.write('秒',font=("Arial", 30, "normal")) else: popstart(eval(i)) def main(): t.setup(1000, 800, None,None) t.penup() t.fd(-350) t.pensize(6) popdate(time.strftime('%Y-%m=%d+%H*%M/%S!',time.localtime())) t.hideturtle() main()
标签:popline,False,绘制,30,else,数码管,fd,True 来源: https://www.cnblogs.com/520620asd/p/13837876.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。