docstr: Display a call stack and exception traceback.
  
  This allows the user to probe the contents of any frame in the given stack.
  
  *frame* may either be a Frame instance or None, in which case the current 
  frame is retrieved from ``sys._getframe()``. 
  
  If *tb* is provided then the frames in the traceback will be appended to 
  the end of the stack list. If *tb* is None, then sys.exc_info() will 
  be checked instead.
docstr_tok: ["Display","a","call","stack","and","exception","traceback",".","This","allows","the","user","to","probe","the","contents","of","any","frame","in","the","given","stack",".","*","frame","*","may","either","be","a","Frame","instance","or","None",",","in","which","case","the","current","frame","is","retrieved","from","``","sys._getframe","(",")","``",".","If","*","tb","*","is","provided","then","the","frames","in","the","traceback","will","be","appended","to","the","end","of","the","stack","list",".","If","*","tb","*","is","None",",","then","sys.exc_info","(",")","will","be","checked","instead","."]
code: def setStack(self, frame=None, expand=True, lastFrame=None):
      """Display a call stack and exception traceback.
  
      This allows the user to probe the contents of any frame in the given stack.
  
      *frame* may either be a Frame instance or None, in which case the current
      frame is retrieved from ``sys._getframe()``.
  
      If *tb* is provided then the frames in the traceback will be appended to
      the end of the stack list. If *tb* is None, then sys.exc_info() will
      be checked instead.
      """
      if frame is None:
          frame = sys._getframe().f_back
  
      self.clear()
  
      stack = stackFromFrame(frame, lastFrame=lastFrame)
      items = makeItemTree(stack, "Call stack")
      self.addTopLevelItem(items[0])
      if expand:
          items[0].setExpanded(True)
  
file_path: pyqtgraph/pyqtgraph/console/stackwidget.py
imports: import sys, traceback
  from ..Qt import QtWidgets, QtGui
label_desc: Use image node_id 5 for calling the StackWidget obj's underlying member method code with example usage: obj.setStack(frame, expand, lastFrame) without return types