class_docstr: Code stack viewer for debugger GUI.
code: def load_stack(self, stack, index=None):
      self.stack = stack
      self.clear()
      for i in range(len(stack)):
          frame, lineno = stack[i]
          try:
              modname = frame.f_globals["__name__"]
          except:
              modname = "?"
          code = frame.f_code
          filename = code.co_filename
          funcname = code.co_name
          import linecache
  
          sourceline = linecache.getline(filename, lineno)
          sourceline = sourceline.strip()
          if funcname in ("?", "", None):
              item = "%s, line %d: %s" % (modname, lineno, sourceline)
          else:
              item = "%s.%s(), line %d: %s" % (
                  modname,
                  funcname,
                  lineno,
                  sourceline,
              )
          if i == index:
              item = "> " + item
          self.append(item)
      if index is not None:
          self.select(index)
  
imports: import bdb
  import os
  from tkinter import *
  from tkinter.ttk import Frame, Scrollbar
  from idlelib import macosx
  from idlelib.scrolledlist import ScrolledList
  from idlelib.window import ListedToplevel
label_desc: Use image node_id 2 for calling the StackViewer obj's underlying member method code with example usage: obj.load_stack(stack, index) without return types