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_item_state(self, item_id, state):
      d = self.get_item_data(item_id)
      d[None] = state
      image_index, selected_index = self.img_idx(d)
      self.tree_ctrl.SetItemImage(
          item_id, image_index, wx.TreeItemIcon_Normal
      )
      self.tree_ctrl.SetItemImage(
          item_id, selected_index, wx.TreeItemIcon_Selected
      )
      self.tree_ctrl.SetItemImage(
          item_id, image_index, wx.TreeItemIcon_Expanded
      )
      self.tree_ctrl.SetItemImage(
          item_id, selected_index, wx.TreeItemIcon_SelectedExpanded
      )
      if len(d) > 1:
          if self.tree_ctrl.GetChildrenCount(item_id) == 0:
              self.populate(item_id)
          child_id, _ = self.tree_ctrl.GetFirstChild(item_id)
          while True:
              d1 = self.get_item_data(child_id)
              if d1[None] is not state:
                  self.set_item_state(child_id, state)
              if child_id == self.tree_ctrl.GetLastChild(item_id):
                  break
              child_id = self.tree_ctrl.GetNextSibling(child_id)
  
file_path: CellProfiler/src/frontend/cellprofiler/gui/_tree_checkbox_dialog.py
imports: import wx
label_desc: Use image node_id 9 for calling the TreeCheckboxDialog obj's underlying member method code with example usage: obj.set_item_state(item_id, state) without return types