【发布时间】:2022-12-05 19:27:22
【问题描述】:
import customtkinter as CTK
class App(CTK.CTk):
def __init__(self):
super().__init__()
self.bar = CTK.CTkProgressBar(master=self.checkbox, orientation='horizontal', mode='determinate')
self.bar.grid(row=10, column=0, pady=10, padx=20, sticky="n")
def test(self):
for x in range(500):
return x**2
我想要这样当我想要运行测试功能时(通过我已经制作的按钮,它本身可以正常工作)栏开始,当它结束时它停止。尽管最好的办法是在 UI 本身中使用 tqdm 进度条代替 tkinter 进度条?
我试过添加 self.bar.start() 并在函数的开始/结束处停止,但似乎不起作用。它仅在函数本身完成后运行。
【问题讨论】:
标签: python-3.x tkinter progress-bar tqdm customtkinter