I'm new to Python and trying to use PyQt6 QTabsWidget. I have problems with setting the tabs to West. By the documentation the following code should work but PyCharm just gives me AttributeError: type object 'QTabWidget' has no attribute 'West' even though the official documentation says it should have that attribute. I've also seen this one in every guide and tutorial about QTabWidget.
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle('MyApp')
tabs = QTabWidget()
tabs.setTabPosition(QTabWidget.West)
tabs.setMovable(True)
By looking into the QtWidgets.pyi file I found some functions inside the class definition of QTabWidget. Using those I got the following code that works.
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle('MyApp')
tabs = QTabWidget()
tabs.setTabPosition(QTabWidget.TabPosition(2))
tabs.setMovable(True)
Why isn't the first one working?