How do i resize the contents of a QScrollArea as more widgets are placed inside

If you’re coming here from Google and not having luck with the accepted answer, that’s because you’re missing the other secret invocation: QScrollArea::setWidget. You must create and explicitly identify a single widget which is to be scrolled. It’s not enough to just add the item as a child! Adding multiple items directly to the ScrollArea … Read more

PySide / PyQt detect if user trying to close window

Override the closeEvent method of QWidget in your main window. For example: class MainWindow(QWidget): # or QMainWindow … def closeEvent(self, event): # do stuff if can_exit: event.accept() # let the window close else: event.ignore() Another possibility is to use the QApplication‘s aboutToQuit signal like this: app = QApplication(sys.argv) app.aboutToQuit.connect(myExitHandler) # myExitHandler is a callable

tech