class_docstr: A dialog for "selecting" items on a tree by checking them
class_docstr_tok: ["A","dialog","for","``","selecting","''","items","on","a","tree","by","checking","them"]
code: def set_parent_state(self, item_id):
      if item_id != self.root_id:
          parent_id = self.tree_ctrl.GetItemParent(item_id)
          d_parent = self.get_item_data(parent_id)
          child_id, _ = self.tree_ctrl.GetFirstChild(parent_id)
          state = self.get_item_data(child_id)[None]
          while True:
              if child_id == self.tree_ctrl.GetLastChild(parent_id):
                  break
              child_id = self.tree_ctrl.GetNextSibling(child_id)
              next_state = self.get_item_data(child_id)[None]
              if next_state != state:
                  state = None
                  break
  
          if d_parent[None] is not state:
              if state is False and not self.parent_reflects_child:
                  state = None
              d_parent[None] = state
              image_index, selected_index = self.img_idx(d_parent)
              self.tree_ctrl.SetItemImage(
                  parent_id, image_index, wx.TreeItemIcon_Normal
              )
              self.tree_ctrl.SetItemImage(
                  parent_id, selected_index, wx.TreeItemIcon_Selected
              )
              self.tree_ctrl.SetItemImage(
                  parent_id, image_index, wx.TreeItemIcon_Expanded
              )
              self.tree_ctrl.SetItemImage(
                  parent_id,
                  selected_index,
                  wx.TreeItemIcon_SelectedExpanded,
              )
              self.set_parent_state(parent_id)
  
file_path: CellProfiler/src/frontend/cellprofiler/gui/_tree_checkbox_dialog.py
imports: import wx
label_desc: Use image node_id 8 for calling the TreeCheckboxDialog obj's underlying member method code with example usage: obj.set_parent_state(item_id) without return types