0

I am making a quiz application in PyQt5. I added text, a button and a background image, but the next question was how to make the window adaptive? I googled a lot, but I didn’t find anything here is the code:

`from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QPixmap

import sys


class QuizApplication(QMainWindow):
    def __init__(self):
        super(QuizApplication, self).__init__()

        self.setWindowTitle("Quiz")
        self.setGeometry(600, 100, 648, 500)

        self.pixmap = QPixmap("background_image.jpg")
        self.background_label = QtWidgets.QLabel(self)
        self.background_label.setPixmap(self.pixmap)
        self.background_label.adjustSize()

        self.welcome_label = QtWidgets.QLabel(self)
        self.welcome_label.move(100, 0)
        self.welcome_label.setText("It will be a quiz on history, philosophy and social studies")
        self.welcome_label.adjustSize()

        self.start_button = QtWidgets.QPushButton(self)
        self.start_button.move(220, 20)
        self.start_button.setText("Press to start!")
        self.start_button.adjustSize()
def aplication_setup():
    app = QApplication(sys.argv)
    window = QuizApplication()

    window.show()
    sys.exit(app.exec_())


if __name__ == "__main__":
    aplication_setup()`
```
`[this is my window](https://i.stack.imgur.com/JQYS6.jpg)

I tried using QGridLayout but nothing worked

0 Answers0