Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

PYQT5 Stacked Widgets not resizing



  • I'm trying to switch windows with Stacked Widget and it works, however, when I use a window that is a different size from the rest, every other window now has to follow the sizing of the biggest window.
    Is there any way of changing this?



  • @ametefe
    I found this behaviour when I used QStackedWidget. It resizes to the largest page (which after a while seems preferable anyway). So if don't want that I can only imagine you would have to resize manually/on up-front in code.



  • @JonB
    I have tried resizing manually but it never resizes. Can you give me an example, please?



  • @ametefe
    No, because I said I never did resize, I came to like the common-size-for-all behaviour.



  • @JonB
    Do you have any other way to call another widget, because the other methods I have seen, involve turning the pyqt UI into python code.



  • @ametefe said in PYQT5 Stacked Widgets not resizing:

    Do you have any other way to call another widget

    I do not know what this means.

    If you use Designer to produce .ui files, you can either run the Python uic to generate Python .py file code from it or you can use UiLoader thingie to load the file dynamically at runtime instead of generating code for it. Exacts depend on whether you are PyQt or PySide, the alternatives are documented somewhere in introductory topics for the two Python bindings.

    I don't see that either of these approaches will have any effect on the runtime behaviour of your widgets/QStackedWidget, if that is what you are expecting.


Log in to reply