code: def makeItemTree(stack, title):
      topItem = QtWidgets.QTreeWidgetItem([title])
      topItem.frame = None
      font = topItem.font(0)
      font.setWeight(font.Weight.Bold)
      topItem.setFont(0, font)
      items = [topItem]
      for entry in stack:
          if isinstance(entry, QtWidgets.QTreeWidgetItem):
              item = entry
          else:
              text, frame = entry
              item = QtWidgets.QTreeWidgetItem([text.rstrip()])
              item.frame = frame
          topItem.addChild(item)
          items.append(item)
      return items
  
file_path: pyqtgraph/pyqtgraph/console/stackwidget.py
imports: import sys, traceback
  from ..Qt import QtWidgets, QtGui
label_desc: Use image node_id 3 for calling a global function with example usage: makeItemTree(stack, title) and returns: items