本文介绍了Python/Tkinter:打开/关闭屏幕更新,例如wxPython冻结/解冻?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Tkinter是否提供一种方法来临时关闭屏幕更新(执行大量屏幕活动时),然后在UI更新完成后打开屏幕更新?许多GUI框架都具有此功能. wxPython为此功能提供了Freeze和Thaw方法. Windows Win32api也通过LockWindowUpdate(hWnd | 0)支持此功能.空洞地搜索了"tkinter冻结解冻"和"tkinter lockwindowupdate".

Does Tkinter provide a way to temporarily turn off screen updates (when performing a large amount of screen activity) and then turn on screen updates when the UI updates are complete? Many GUI frameworks have this feature. wxPython provides Freeze and Thaw methods for this functionality. The Windows Win32api supports this as well via LockWindowUpdate( hWnd | 0 ). Googling on "tkinter freeze thaw" and "tkinter lockwindowupdate" came up emtpy.

推荐答案

不,Tkinter没有这样的东西.但是,仅通过事件循环来更新屏幕,因此,如果所有大量屏幕活动"都在单个方法中发生,则直到您的方法完成并且重新进入事件循环之前,所有活动都不会显示(或者您明确呼叫.update_idletasks())

No, Tkinter has no such thing. However, the screen is only updated via the event loop, so if all of your "large amount of screen activity" is happening in a single method, none of the activity will show up until your method finishes and the event loop is re-entered (or you explicitly call .update_idletasks())

这篇关于Python/Tkinter:打开/关闭屏幕更新,例如wxPython冻结/解冻?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 19:11