# Disable tristate checkboxes in ctkCheckableComboBox

**URL:** <https://discourse.slicer.org/t/disable-tristate-checkboxes-in-ctkcheckablecombobox/29898>\
**Category:** Support\
**Tags:** python, gui\
**Created:** [June 7, 2023, 1:26pm UTC](https://discourse.slicer.org/t/disable-tristate-checkboxes-in-ctkcheckablecombobox/29898 "2023-06-07T13:26:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abertelsen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/abertelsen/32/8788_2.png) [@abertelsen](https://discourse.slicer.org/u/abertelsen)\
**Post date:** [June 7, 2023, 1:26pm UTC](https://discourse.slicer.org/t/disable-tristate-checkboxes-in-ctkcheckablecombobox/29898/1 "2023-06-07T13:26:38Z")

</div>

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.

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/8/f8e76dddedeeffb8fb6352f6fe9d34c2a3bded11.png)

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

Any help is welcome!

Thanks,  
Álvaro

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [June 7, 2023, 2:19pm UTC](https://discourse.slicer.org/t/disable-tristate-checkboxes-in-ctkcheckablecombobox/29898/2 "2023-06-07T14:19:14Z")

</div>

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

```python
checkable_combobox = ctk.ctkCheckableComboBox()
checkable_combobox.addItems(["L1", "L2", "L3"])
checkable_combobox.show()
# 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.

```python
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

```
