Disable tristate checkboxes in ctkCheckableComboBox

Hello everybody!

A quick question: is there a way to disable the tristate behaviour in ctkCheckableComboBox? For my application, the usual checked or unchecked states are more appropriate.


I forgot to mention that I am using Python, for a scripted module (in Slicer 5.2.2).

Any help is welcome!


Below code shows that the ctkCheckableComboBox by default does not have tristate when using from the GUI.

checkable_combobox = ctk.ctkCheckableComboBox()
checkable_combobox.addItems(["L1", "L2", "L3"])
# Manually check the "L3" checkbox and observe that there are only 2 states (Checked/Unchecked support)

However below is where I think you are likely misusing the API and making the checkboxes go into the PartiallyChecked state.

checked_items = checkable_combobox.checkedIndexes()
single_checked_item = checked_items[0]
# https://doc.qt.io/qt-5/qcheckbox.html#setCheckState
# https://doc.qt.io/qt-5/qt.html#CheckState-enum (0 for Unchecked, 1 for PartiallyChecked, 2 for Checked)
# Note that Check State takes in a CheckState and not a boolean
# Different from a QCheckBox which has SetChecked which does take a boolean
checkable_combobox.setCheckState(single_checked_item, True) # This is not setting to the "Checked" state, but rather the "PartiallyChecked" state because True == 1