code: def switch_context(self, page):
          
          # noinspection PyUnresolvedReferences
          if page.objectName() == 'profile_edit_page':
              self.stacked_widget.setCurrentIndex(0)
              self.button_box.button(QDialogButtonBox.Close).setHidden(False)
          else:  # resource_edit_page
              self.stacked_widget.setCurrentIndex(1)
              # hide the close button
              self.button_box.button(QDialogButtonBox.Close).setHidden(True)
docs: Switch context tabs by tab widget name.
  
          :param page: The page should be focussed.
          :type page: QWidget