How to check if a checkbox is checked in pyqt
x = self.folderactive.isChecked()
x
will be True
or False
—a Boolean value.
(It's the brackets at the end that make the difference.)
self.folderactive.isChecked
isn't a boolean, it's a method - which, in a boolean context, will always evaluate to True
. If you want the state of the checkbox, just invoke the method:
if self.folderactive.isChecked():
...
else:
...