我正在用python 2.7
中的tkinter
创建一个gui。在GUI中有执行功能的按钮。问题是,当点击按钮时,直到整个功能完成,它才显示标签。示例代码:
button4=tk.Button(self,text="MEMORY",height=1,width=20,font=LABEL_FONT,fg=mycolor,bg='light blue',command=lambda: controller.show_frame(memory))
button4.place(relx=0.6, rely=.53,width=120, anchor="sw")
与按钮关联的功能是:
def memory(self):
label = tk.Label(
self,
text="Calculating, Please wait...",
font=text_font,
fg="white",
bg=mycolor)
label.place(relx=.0005, rely=.17)
f3 = open('filename' ,"r")
list1= list()
list2= list()
# Calculating some values which takes around 5 minutes as the lists are huge
此处文本“请稍候…”仅在5分钟后显示,即在计算后显示。我需要的文本(标签)显示后不久,按钮被点击。你知道吗
谢谢你的帮助。你知道吗
在开始长时间计算之前调用update
但你最好用线
相关问题 更多 >
编程相关推荐