When you use the QToolButton in pyqt, if you want to achieve different functions by pressing and lifting, you must add this sentence:
The basic code for setting up a toolbutton is:
self.btn_1 = QToolButton(self) self.btn_1.setText('start') self.btn_1.setCheckable(True) self.btn_1.clicked.connect(self.btn_1_function) def btn_1_function(self): if self.btn_1.isChecked(): pass else: pass
The above article to solve the problem that the QoolButton in pyqt5 can not be used is the whole content shared by the editor. I hope to give you a reference, and I hope you will support developpaer more.