我想让我的程序像这样倒计时
3..
2..
1..
在文本“ Number:”之前将其倒数,然后再显示一个随机数。
from tkinter import *
import random
import time
#Main Window
main = Tk()
main.title("Random Picker || Teacher Proud")
def RandomNumber():
MyRandom = random.randint(1, 36)
guess.configure(text="Number: " + str(MyRandom))
def RandomNumber1():
MyRandom = random.randint(1, 46)
guess.configure(text="Number: " + str(MyRandom))
#Size
canvas = Canvas(main, height=600, width=700)
canvas.pack()
background1 = PhotoImage(file='astronomy-dark-evening-176851.png')
canvas.create_image(50, 50, image=background1)
canvas.create_text(353, 105, text="Special for Teacher Proud", fill='white', font=("Arial", 14))
canvas.create_text(353, 80, text="Random Picker V.2", fill='white', font=("Arial" ,30, "bold italic"))
canvas.create_text(353, 580, text="This application was made by 1/10 students in 2019", fill='white', font=("Arial" , 15, "bold italic"))
canvas.create_text(353, 220, text="GIFTED Students Picker", fill='white', font=("Arial", 20))
canvas.create_text(353, 300, text="Normal Students Picker", fill='white', font=("Arial", 20))
canvas.create_text(353, 489, text="**Please do not maximize**", fill='red', font=("Arial", 23))
button = Button(main, text="Pick!", command=RandomNumber, font=("Helvetica", 15))
button.place(relx=0.4, rely=0.4, relwidth=0.2, relheight=0.04)
button1 = Button(main, text="Pick!", command=RandomNumber1, font=("Helvetica", 15))
button1.place(relx=0.4, rely=0.5285, relwidth=0.2, relheight=0.04)
main.wm_attributes('-alpha', 0.875132)
guess = Label(main, font=("Arial", 25))
guess.place(relx=0.35, rely=0.2, relwidth=0.3, relheight=0.1)
main.mainloop()
from tkinter import *
import random
import time
#Main Window
main = Tk()
main.title("Random Picker || Teacher Proud")
def RandomNumber():
MyRandom = random.randint(1, 36)
guess.configure(text="Number: " + str(MyRandom))
def RandomNumber1():
MyRandom = random.randint(1, 46)
guess.configure(text="Number: " + str(MyRandom))
#Size
canvas = Canvas(main, height=600, width=700)
canvas.pack()
background1 = PhotoImage(file='astronomy-dark-evening-176851.png')
canvas.create_image(50, 50, image=background1)
canvas.create_text(353, 105, text="Special for Teacher Proud", fill='white', font=("Arial", 14))
canvas.create_text(353, 80, text="Random Picker V.2", fill='white', font=("Arial" ,30, "bold italic"))
canvas.create_text(353, 580, text="This application was made by 1/10 students in 2019", fill='white', font=("Arial" , 15, "bold italic"))
canvas.create_text(353, 220, text="GIFTED Students Picker", fill='white', font=("Arial", 20))
canvas.create_text(353, 300, text="Normal Students Picker", fill='white', font=("Arial", 20))
canvas.create_text(353, 489, text="**Please do not maximize**", fill='red', font=("Arial", 23))
button = Button(main, text="Pick!", command=RandomNumber, font=("Helvetica", 15))
button.place(relx=0.4, rely=0.4, relwidth=0.2, relheight=0.04)
button1 = Button(main, text="Pick!", command=RandomNumber1, font=("Helvetica", 15))
button1.place(relx=0.4, rely=0.5285, relwidth=0.2, relheight=0.04)
main.wm_attributes('-alpha', 0.875132)
guess = Label(main, font=("Arial", 25))
guess.place(relx=0.35, rely=0.2, relwidth=0.3, relheight=0.1)
main.mainloop()
我希望它进行倒计时。