您现在的位置是:主页 > news > 无锡企业网站公司/公关团队
无锡企业网站公司/公关团队
admin2025/5/3 2:54:48【news】
简介无锡企业网站公司,公关团队,福州网站建设托管,羽毛球赛事安排我正在用python(Tkinter)编写一个程序,不知怎的,我陷入了一些困惑之中。我想暂停我的程序执行几秒钟,也暂停执行,但不是在正确的时间。我的程序是这样的:from Tkinter import *from time import *rootTk()def login():…
我正在用python(Tkinter)编写一个程序,不知怎的,我陷入了一些困惑之中。
我想暂停我的程序执行几秒钟,也暂停执行,但不是在正确的时间。
我的程序是这样的:from Tkinter import *
from time import *
root=Tk()
def login():
g=str(ent.get())
h=str(ent2.get())
if h=='shubhank' and g=='shubhankt1':
root2=Tk()
root2.title("Shubhank Tyagi")
root2.geometry('300x300')
root2.wm_iconbitmap('st.ico')
name=Label(root2, text='''Name: Shubhank Tyagi
Age: 18 yrs
Sex: Male
Occupation: Student
Designation: Intermediate''')
name.pack()
elif h=='divyansh' and g=='divyansht5':
root2=Tk()
root2.title("Divyansh Tyagi")
root2.geometry('300x300')
root2.wm_iconbitmap('st.ico')
name=Label(root2, text='''Name: Divyansh Tyagi
Age: 18 yrs
Sex: Male
Occupation: Student
Designation: Intermediate''')
name.pack()
else:
error=Label(root, text='Please provide correct info.')
error.pack()
sleep(5)
error.pack_forget()
w=Label(root, text="Username", bg='Light Blue')
ent=Entry(root)
w2=Label(root, text="Password", bg='Light Blue')
ent2=Entry(root)
ent2.config(show=' ')
btn=Button(root, text='Click Me!', command=login)
此按钮(btn)调用定义的函数。
我要的是第一次打印错误信息。。过了一段时间就会被删除。。问题发生在点击按钮后,程序暂停并直接执行error.pack\u忘记()执行函数。。错误信息永远不会被打印出来。。。在
请帮帮我!
(如果需要,我还可以提供实际的PYTHON文件)