When we create a window, by default the window size is resizable although, we can use
setFixedSize() method to set the fixed size of the window but if we want to set only fix length of height or width only we cant use this method. We want to set one length fixed and other be variable in order to do so we have to use
setFixedWidth() method to set fix length of width and
setFizedHeight() method to set fix length of height.
Syntax :self.setFixedWidth(width) self.setFixedHeight(height)
Argument : Both take integer as argument.
setFixedWidth()sets the constant width.
setFixedWidth()sets the constant height.
Code for fixed width –
Code for fixed height –
- PyQt5 – Set maximum size for width or height of window
- PyQt5 – Set minimum length for width/height of Status Bar
- PyQt5 - Set fixed length for width/height of Status Bar
- PyQt5 QSpinBox - How to get the preferred height for the given width
- PyQt5 QSpinBox - Checking if height depend on the width
- PyQt5 QCalendarWidget - Checking if height is preferable to the width
- PyQt5 QCalendarWidget - Getting Height for width
- Getting screen's height and width using Tkinter | Python
- PyQt5 – Set maximum window size
- PyQt5 – How to set minimum size of window | setMinimumSize method
- PyQt5 – Set minimum window size | setMinimumWidth and setMinimumHeight method
- numpy.fix() in Python
- PYGLET – Getting Window Width
- PyQtGraph – Setting Minimum Width of Plot Window
- PyQtGraph – Getting Maximum Width of Plot Window
- PyQtGraph – Setting Maximum Width of Plot Window
- PyQtGraph – Getting Minimum Width of Plot Window
- PYGLET – Getting Window Height
- PyQtGraph – Setting Maximum Height of Plot Window
- PyQtGraph – Getting Minimum Height of Plot Window
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.