Mar-02-2021, 01:41 AM
I'm simply trying to print whatever the user has typed in the QLineEdit named self.snTextBox using the QPushButton called self.cfButton. I tried using str for both but it makes no difference. What do I need to do here? The self.enButton works calling the function enterNewHardware.
App won't even run with the below.
I'm getting this error:
App won't even run with the below.
I'm getting this error:
Error:self.cfButton.clicked.connect(print(serialNumber))
TypeError: argument 1 has unexpected type 'NoneType'
class hardwareTab(QWidget): def __init__(self): super().__init__() self.snLabel = QLabel("SERIAL NUMBER") self.snTextBox = QLineEdit() self.modelLabel = QLabel("MODEL") self.modelTextBox = QLineEdit() self.userLabel = QLabel("USER") self.userTextBox = QLineEdit() self.enButton = QPushButton("ENTER NEW HARDWARE") self.cfButton = QPushButton("CLEAR FIELDS") self.seButton = QPushButton("SEARCH/EDIT HARDWARE") self.activeCheckbox = QCheckBox("ACTIVE") layout = QVBoxLayout(self) layout.addWidget(self.snLabel) layout.addWidget(self.snTextBox) layout.addWidget(self.modelLabel) layout.addWidget(self.modelTextBox) layout.addWidget(self.userLabel) layout.addWidget(self.userTextBox) layout.addWidget(self.activeCheckbox) layout.addWidget(self.enButton) layout.addWidget(self.cfButton) layout.addWidget(self.seButton) self.enButton.clicked.connect(enterNewHardware) serialNumber = self.snTextBox.text() self.cfButton.clicked.connect(print(serialNumber))