【发布时间】:2020-06-01 22:12:04
【问题描述】:
我想多次运行下面的线程,每次它完成时都将结果打印到 tkinter 的标签。
def hasher(path):
hashed_file = self.hash256(path)
tk.Label(self, text=hashed_file).pack()
t = []
for directory in files_dict:
for file in files_dict[directory]:
t.append(threading.Thread(target=hasher, args=(directory+"/"+file,)))
for thr in t:
thr.start()
thr.join()
基本上是为了以后能够更新带有“已完成处理:”的标签 但是,如果我添加 .join() 它会冻结,如果我删除它会完成然后加载页面。
【问题讨论】:
标签: python multithreading tkinter