0

When I tried to show the app in full screen mode, the widgets inside are not resizing and are placed right where they were when creating the app. I want the app to open in full screen mode and the widgets inside show get resized according to the window size.

main.py
#---------------PyQT5 Library---------------#
from PyQt5.QtWidgets import QApplication
from fullScreen import MainWindow
#-------------------------------------------#

#--------------System Library---------------#
import sys
#-------------------------------------------#

def main():
    app = QApplication(sys.argv)
    # app.setStyleSheet(QStyleFactory.create("fusion"))
    fullScreen=MainWindow()
    fullScreen.init()
    fullScreen.show()

    sys.exit(app.exec_())  

if __name__ == '__main__':
# Execute Main Function #
    main()

`

fullscreen.py
#---------------PyQT5 Library---------------#
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets import QMainWindow
from PyQt5 import QtCore
from PyQt5.uic import loadUi
#-------------------------------------------#

class MainWindow(QMainWindow, object):
    def init(self):
        QMainWindow.__init__(self)
            loadUi("test.ui", self)
            # self.setGeometry(0,0,1920,1080)
            # self.showMaximized()
            # self.showFullScreen()
            self.setWindowState(QtCore.Qt.WindowMaximized)
`

test.ui the ui file is shown in the picture.

when I execute this script it is opening in full screen mode but the widgets are placed at the same place. this is the output when I open in full screen mode UI file

  • You must set a main layout for the window, the layouts in the widget box are for *nested* layouts. See the [documentation](https://doc.qt.io/qt-5/designer-layouts.html). – musicamante Aug 06 '23 at 17:03

0 Answers0