Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyQt: Prevent Resize and Maximize in QDialog?

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

like image 648
Antoni4040 Avatar asked Dec 08 '12 07:12

Antoni4040


People also ask

What is dialog in PYQT?

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.


2 Answers

Use setFixedSize:

mydialog.setFixedSize(width, height)
like image 91
Avaris Avatar answered Oct 07 '22 03:10

Avaris


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....

like image 5
Amin Matola Avatar answered Oct 07 '22 04:10

Amin Matola