@contextmanager
def updates_disabled(widget):
 old_state = widget.updatesEnabled()
 widget.setUpdatesEnabled(False)
 try:
  (yield)
 finally:
  widget.setUpdatesEnabled(old_state)

@ contextmanager def updates_disabled ( widget ) : old_state = widget . updatesEnabled ( ) widget . setUpdatesEnabled ( False ) try : ( yield ) finally : widget . setUpdatesEnabled ( old_state )
disable qwidget updates .