Skip to content
Advertisement

Error lambda missing 1 required positional argument when using with QPushButton

This is entire my code:

JavaScript

When I run this code, I get a window like this:image here


Below the buttons, there is a QLabel, and I want when I click on any button, the button’s label will refer to this QLabel, but I get a bunch of confusing errors in the terminal. What’s wrong with my code, help me, thanks.

Advertisement

Answer

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:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement