spacepaste

  1.  
  2. import sys
  3. from PyQt5.QtCore import Qt
  4. from PyQt5.QtWidgets import QApplication, QScrollArea, QPushButton, QFrame, QSplitter
  5. app = QApplication([])
  6. button = QPushButton('button')
  7. button.setMinimumSize(200, 400)
  8. scroll = QScrollArea()
  9. scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
  10. scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
  11. scroll.setWidget(button)
  12. splitter = QSplitter()
  13. splitter.setChildrenCollapsible(False)
  14. splitter.addWidget(scroll)
  15. splitter.addWidget(QFrame())
  16. splitter.show()
  17. # Should happen automatically
  18. # scroll.setMinimumWidth(200 + scroll.verticalScrollBar().width())
  19. sys.exit(app.exec())
  20.