code: def set_tab(self, widget, switch=False, title=None):
          
          if widget not in self._widgets:
              self._widgets.append(widget)
              self._widget_title[widget] = ''
          if switch:
              self._tab_index = self._widgets.index(widget)
          if title:
              self._widget_title[widget] = title
          self._update_tabs()
docs: Add or modify a tab.
  
          If widget is not a tab, it will be added. If switch is True, switch to
          this tab. If title is given, set the tab's title.