#七段数码管实现倒计时
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(digit):
drawLine(True) if digit in [2,3,4,5,6,8,9]else drawLine(False)
drawLine(True) if digit in [0,1,3,4,5,6,7,8,9]else drawLine(False)
drawLine(True) if digit in [0,2,3,5,6,8,9]else drawLine(False)
drawLine(True) if digit in [0,2,6]else drawLine(False)
turtle.left(90)
drawLine(True) if digit in [0,4,5,6,8,9]else drawLine(False)
drawLine(True) if digit in [0,2,3,5,6,7,8,9]else drawLine(False)
drawLine(True) if digit in [0,1,2,3,4,7,8,9]else drawLine(False)
turtle.left(180)
turtle.penup()
turtle.fd(20)
def Countdown():
turtle.pencolor("green")
for i in range(5,-1,-1):
drawDigit(i)
turtle.clear()
turtle.home()
def main():
turtle.setup(700,500)
turtle.penup()
turtle.pensize(5)
Countdown()
turtle.hideturtle()
turtle.done()
main()
06-11
406
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)