How can I prevent a QDialog in PyQt from being resizeable or maximazable? I don't want the window's size changed.
Dialogs are useful GUI components that allow you to communicate with the user (hence the name dialog). They are commonly used for file Open/Save, settings, preferences, or for functions that do not fit into the main UI of the application.
Use setFixedSize:
mydialog.setFixedSize(width, height)
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....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With