how to connect button to function in pyqt5 code example Example: pyqt5 button connect button.clicked.connect(self.on_click)