写入代码
七段电子数码管时间是自动输入电脑现在的日期
#导入库模块
#import tutle
#turtle.penuo()...
#import.turtle as t
#t.done() ...
from turtle import *
from random import *
import time
#绘制单段间隔
def drawGap():
penup()
fd(5)
#绘制单段数码管(单个数字)
def drawLine(draw):
if draw:
pendown()
else:
penup()
fd(40)
drawGap()
right(90)
#根据数字绘制七段数码管(多个数字)
def drawDigit(digit):
pencolor(random(),random(),random())
drawLine(True) if digit in [2,3,4,5,6,8,9] else drawLine(False)
pencolor(random(),random(),random())
drawLine(True) if digit in [0,1,3,4,5,6,7,8,9] else drawLine(False)
pencolor(random(),random(),random())
drawLine(True) if digit in [0,2,3,5,6,8] else drawLine(False)
pencolor(random(),random(),random())
drawLine(True) if digit in [0,2,6,8] else drawLine(False)
left(90)
pencolor(random(),random(),random())
drawLine(True) if digit in [0,4,5,6,8,9] else drawLine(False)
pencolor(random(),rand