PyQt5 – Set maximum size for width or height of window
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 –
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course