I have the following code:
acquisition.main() returns a matplotlib plot of some data from an oscilloscope. This plot appears perfectly fine when acquisition.main() is called in any other way.
How can I fix this?
Doh! There was a naming error. Problem solved.
from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * from gui import Ui_mainWindow import acquisition class Logic(QtWidgets.QMainWindow, Ui_mainWindow): def __init__(self, *args, **kwargs): super(Logic, self).__init__(*args, **kwargs) self.setupUi(self) ###SIGNALS### self.actionExit.triggered.connect(self.closeEvent) self.actionExit_2.triggered.connect(self.closeEvent) self.startScan.clicked.connect(self.startScan) self.show() def closeEvent(self, event): buttonReply = QtWidgets.QMessageBox.question(self, "Exit", "Are you sure want to quit?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No, QtWidgets.QMessageBox.No) if buttonReply == QtWidgets.QMessageBox.Yes: sys.exit(app.exec_()) else: event.ignore() def startScan(self): acquisition.main() if __name__ == "__main__": app = QApplication([]) app.setApplicationName("xxxx") window = Logic() app.exec_()Which returns:
TypeError: argument 1 has unexpected type 'QPushButton'whenever ran. I have read that using
self.startScan.clicked.connect(lambda:self.startScan)can alleviate some of these TypeErrors, but for me, the program will simply close if I use the startScan pushbutton.
acquisition.main() returns a matplotlib plot of some data from an oscilloscope. This plot appears perfectly fine when acquisition.main() is called in any other way.
How can I fix this?
Doh! There was a naming error. Problem solved.
self.startScan.clicked.connect(self.startScan)Should be:
self.startScan.clicked.connect(self.beginScan)and the startScan(self) function should be renamed to beginScan(self)