code: def toggle_dock_visibility(self):
          
          if self.dock_widget.isVisible():
              self.dock_widget.setVisible(False)
          else:
              self.dock_widget.setVisible(True)
              self.dock_widget.raise_()
docs: Show or hide the dock widget.