问题描述
import tkinter as tk
import time
import winsound
root = tk.Tk()
root.geometry("400x400")
root.title("clock")
def start(n):
i =m= n*60
while i >= 0:
m,s = divmod(i,60)
h,m = divmod(m,60)
l3.config(text = str(h).zfill(2))
l4.config(text = str(m).zfill(2))
l5.config(text = str(s).zfill(2))
time.sleep(1)
i = i - 1
n = int(input("enter countdown in minutes"))
l1 = tk.Label(root,text = " : ")
l1.place(x = 100,y = 250)
l2 = tk.Label(root,text = " : ")
l2.place(x = 200,y = 250)
l3 = tk.Label(text = "")
l3.place(x = 50,y = 250)
l4 = tk.Label(text = "",)
l4.place(x = 150,y = 250)
l5 = tk.Label(text = "")
l5.place(x = 250,y = 250)
but = tk.Button(root,text = "start",command = start )
but.place(x = 150,y= 300,height = 20,width = 30)
root.mainloop()
配置时面临的问题 循环中的标签... 它只是替换循环的最终值。 “我无法用提到的标签替换每个迭代值”
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)