from PySide6.QtWidgets import QApplication, QWidget, QMainWindow, QDockWidget from PySide6.QtCore import * # Only needed for access to command line arguments import sys # You need one (and only one) QApplication instance per application. # Pass in sys.argv to allow command line arguments for your app. # If you know you won't use command line arguments QApplication([]) works too. class MainWindow(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.initUI() def initUI(self): # Central widget is not used. dummyWidget = QWidget() dummyWidget2 = QWidget() self.setCentralWidget(dummyWidget) self.dockWidget = QDockWidget() self.dockWidget.setAllowedAreas(Qt.RightDockWidgetArea | Qt.LeftDockWidgetArea) self.dockWidget.setWidget(dummyWidget2) self.addDockWidget(Qt.LeftDockWidgetArea, self.dockWidget) app = QApplication(sys.argv) ex = MainWindow() app.processEvents() ex.setVisible(True) # Start the event loop. app.exec_() # Your application won't reach here until you exit and the event # loop has stopped.