我正在运行一个缓慢的过程,使用由我的脚本组合在一起的LaTeX来构建一组pdf。在
PDF构建在for循环中。我想显示一个状态窗口,它将为循环经过的每个学生添加一行,以便您可以看到进度。我一直在用print
来做这件事,但是我想要一个能与我移动到的Tkinter接口很好地集成的东西。在
我有这个:
ReStatuswin = Toplevel(takefocus=True)
ReStatuswin.geometry('800x300')
ReStatuswin.title("Creating Reassessments...")
Rebox2 = MultiListbox(ReStatuswin, (("Student", 15), ("Standard", 25), ("Problems", 25) ))
Rebox2.pack(side = TOP)
OKR = Button(ReStatuswin, text='OK', command=lambda:ReStatuswin.destroy())
OKR.pack(side = BOTTOM)
然后循环:
^{pr2}$然后,在循环内部,在PDF制作完成后
Rebox2.insert(END, listy)
它很好地插入了行,但只有在整个循环完成之后,它们才会显示出来(以及ReBox2窗口本身)。在
你知道是什么原因导致延迟显示吗?在
谢谢!在
是的,据我所知,有两个问题。首先,不需要用每个新条目更新显示。第二,不是用按钮触发for循环,而是在启动时运行它(这意味着在循环退出之前不会创建显示)。然而不幸的是,我不能真正地使用你给出的代码,因为它是一个更大的东西的片段。但是,我做了一个小脚本,应该演示如何做你想做的事情:
相关问题 更多 >
编程相关推荐