When we create a window, by default the window size is resizable, although we can use
setMaximumSize() method to set the maximum size of the window. But what if we want to set maximum length only for width or height only. In order to do so we use
setMaximumHeight() method to set maximum width / height. When we use these method other length will be variable i.e there will be no maximum length to it, it can be stretched to the size of screen.
Syntax :self.setMaximumWidth(width) self.setMaximumHeight(height)
Argument : Both takes integer as argument.
Action performed :
setMaximumWidth()sets the maximum width.
setMaximumHeight()sets the maximum height.
Code for maximum width –
Code for maximum height –
- PyQt5 – Set fix window size for height or width
- 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
- PyQt5 – Set maximum window size
- PyQtGraph – Getting Maximum Width of Plot Window
- PyQtGraph – Setting Maximum Width of Plot Window
- PyQtGraph – Setting Maximum Height of Plot Window
- PyQtGraph – Getting Maximum Height of Plot Window
- Getting screen's height and width using Tkinter | Python
- PyQt5 – How to set minimum size of window | setMinimumSize method
- PyQt5 – Set minimum window size | setMinimumWidth and setMinimumHeight method
- PYGLET – Getting Window Width
- PyQtGraph – Setting Minimum Width of Plot Window
- PyQtGraph – Getting Minimum Width of Plot Window
- PYGLET – Getting Window Height
- 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 email@example.com. 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.