code: def __init__(self):
      QtWidgets.QMainWindow.__init__(self)
      self.ui = ui_template.Ui_Form()
      self.cw = QtWidgets.QWidget()
      self.setCentralWidget(self.cw)
      self.ui.setupUi(self.cw)
      self.setWindowTitle("PyQtGraph Examples")
      self.codeBtn = QtWidgets.QPushButton("Run Edited Code")
      self.codeLayout = QtWidgets.QGridLayout()
      self.ui.codeView.setLayout(self.codeLayout)
      self.hl = PythonHighlighter(self.ui.codeView.document())
      app = QtWidgets.QApplication.instance()
      app.paletteChanged.connect(self.updateTheme)
      policy = QtWidgets.QSizePolicy.Policy.Expanding
      self.codeLayout.addItem(
          QtWidgets.QSpacerItem(100, 100, policy, policy), 0, 0
      )
      self.codeLayout.addWidget(self.codeBtn, 1, 1)
      self.codeBtn.hide()
  
      textFil = self.ui.exampleFilter
      self.curListener = None
      self.ui.exampleFilter.setFocus()
      self.ui.qtLibCombo.addItems(self.bindings.keys())
      self.ui.qtLibCombo.setCurrentIndex(self.bindings[QT_LIB])
  
      def onComboChanged(searchType):
          if self.curListener is not None:
              self.curListener.disconnect()
          self.curListener = textFil.textChanged
          # In case the regex was invalid before switching to title search,
          # ensure the "invalid" color is reset
          self.ui.exampleFilter.setStyleSheet("")
          if searchType == "Content Search":
              self.curListener.connect(self.filterByContent)
          else:
              self.hl.searchText = None
              self.curListener.connect(self.filterByTitle)
          # Fire on current text, too
          self.curListener.emit(textFil.text())
  
      self.ui.searchFiles.currentTextChanged.connect(onComboChanged)
      onComboChanged(self.ui.searchFiles.currentText())
  
      self.itemCache = []
      self.populateTree(
          self.ui.exampleTree.invisibleRootItem(), utils.examples_
      )
      self.ui.exampleTree.expandAll()
  
      self.resize(1000, 500)
      self.show()
      self.ui.splitter.setSizes([250, 750])
  
      self.oldText = self.ui.codeView.toPlainText()
      self.ui.loadBtn.clicked.connect(self.loadFile)
      self.ui.exampleTree.currentItemChanged.connect(self.showFile)
      self.ui.exampleTree.itemDoubleClicked.connect(self.loadFile)
      self.ui.codeView.textChanged.connect(self.onTextChange)
      self.codeBtn.clicked.connect(self.runEditedCode)
      self.updateCodeViewTabWidth(self.ui.codeView.font())
  
imports: import keyword
  import os
  import pkgutil
  import re
  import subprocess
  import sys
  from argparse import Namespace
  from collections import OrderedDict
  from functools import lru_cache
  import pyqtgraph
  from pyqtgraph.Qt import QT_LIB, QtCore, QtGui, QtWidgets
  import exampleLoaderTemplate_generic
  import utils
label_desc: Use image node_id 1 to create a new ExampleLoader object from inherited base classes: QtWidgets with example: obj = ExampleLoader()