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"]
docstr: Populate the subitems of a tree
docstr_tok: ["Populate","the","subitems","of","a","tree"]
code: def populate(self, item_id):
      """Populate the subitems of a tree"""
      try:
          d = self.get_item_data(item_id)
          assert len(d) > 1
          if self.tree_ctrl.GetChildrenCount(item_id, False) == 0:
              for key in sorted(
                  [x for x in list(d.keys()) if x is not None]
              ):
                  d1 = d[key]
                  if hasattr(d1, "__call__"):
                      # call function to get real value
                      self.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
                      d1 = d1()
                      d[key] = d1
                  image_index, selected_index = self.img_idx(d1)
                  sub_id = self.tree_ctrl.AppendItem(
                      item_id, key, image_index, selected_index, d1
                  )
                  self.tree_ctrl.SetItemImage(
                      sub_id, image_index, wx.TreeItemIcon_Normal
                  )
                  self.tree_ctrl.SetItemImage(
                      sub_id, selected_index, wx.TreeItemIcon_Selected
                  )
                  self.tree_ctrl.SetItemImage(
                      sub_id, image_index, wx.TreeItemIcon_Expanded
                  )
                  self.tree_ctrl.SetItemImage(
                      sub_id,
                      selected_index,
                      wx.TreeItemIcon_SelectedExpanded,
                  )
                  self.tree_ctrl.SetItemHasChildren(sub_id, len(d1) > 1)
      finally:
          self.SetCursor(wx.NullCursor)
  
file_path: CellProfiler/src/frontend/cellprofiler/gui/_tree_checkbox_dialog.py
imports: import wx
label_desc: Use image node_id 6 for calling the TreeCheckboxDialog obj's underlying member method code with example usage: obj.populate(item_id) without return types