[GIS] Find out if checkbox checked – pyqgis

pyqgispyqt

I'm new to pyqgis and I'm not sure how can I find out if checkbox is checked and according to the result do different things in another method?

I know how to do it in theory, but if someone can show me your code I will be thankfull.

Best Answer

You can simply write something like:

if self.dlg.myCheckBox.isChecked():
   doSomething()
else:
   doSomethingElse()

Note that if you want something more dynamic (ie perform an action everytime the checkbox is checked/unchecked), you will have to use PyQt signals.

Related Question