PyQt: Prevent Resize and Maximize in QDialog?

41,109

Solution 1

Use setFixedSize:

mydialog.setFixedSize(width, height)

Solution 2

The above answers are just fine, besides, you could set maximum and mini widths and heights manually, like this:

myDialog = QDialog()
myDialog.setMaximumWidth(myDialog.width())
myDialog.setMaximumHeight(myDialog.height())

or in short, you could use maximumSize as:

myDialog.setMaximumSize()

Just as in the above code....

Share:
41,109
Antoni4040
Author by

Antoni4040

Trying to create beautiful and interesting websites and possibly make some money as well...

Updated on July 18, 2022

Comments

  • Antoni4040
    Antoni4040 almost 2 years

    How can I prevent a QDialog in PyQt from being resizeable or maximazable? I don't want the window's size changed.