Skip to content Skip to sidebar Skip to footer

Error Lambda Missing 1 Required Positional Argument When Using With QPushButton

This is entire my code: import sys from PySide2.QtCore import Qt from PySide2.QtWidgets import ( QApplication, QHBoxLayout, QLabel, QMainWindow, QPushButton,

Solution 1:

The clicked signal is overload so it accepts 2 signatures where it can send a bool or not. The default signature depends on the library, in this case it seems that PySide2 by default does not send the "checked" parameter, unlike PyQt5 that does.

The solution is to indicate the signature:

button.clicked[bool].connect(lambda checked, a=a: self.button_clicked(a))

Post a Comment for "Error Lambda Missing 1 Required Positional Argument When Using With QPushButton"