How to use signals and slots in Slicer 3d?

A previous post of mine mentioned some about basics of using Qt signals and slots with python.

Essentially the syntax is something like {object}.{signal_name}.connect({slot_name}).

So something that is based on QProgressBar will have these signals such as valueChanged. Therefore

def printMyNewValue(value):
  print("The progress bar value is now: {}".format(value))

import qt
progress_bar = qt.QProgressBar()
progress_bar.setMaximum(10)
progress_bar.valueChanged.connect(printMyNewValue)
progress_bar.setValue(4)  # will then print "The progress bar value is now: 4"