-
- import sys
-
- from PyQt5.QtCore import Qt
- from PyQt5.QtWidgets import QApplication, QScrollArea, QPushButton, QFrame, QSplitter
-
- app = QApplication([])
-
- button = QPushButton('button')
- button.setMinimumSize(200, 400)
-
- scroll = QScrollArea()
- scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
- scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
- scroll.setWidget(button)
-
- splitter = QSplitter()
- splitter.setChildrenCollapsible(False)
-
- splitter.addWidget(scroll)
- splitter.addWidget(QFrame())
-
- splitter.show()
-
- # Should happen automatically
- # scroll.setMinimumWidth(200 + scroll.verticalScrollBar().width())
-
- sys.exit(app.exec())
-