setGeometry method – Pyqt5
There are so many options provided by Python to develop GUI application and PyQt5 is one of them. PyQt5 is cross-platform GUI toolkit, a set of python bindings for Qt v5. One can develop an interactive desktop application with so much ease because of the tools and simplicity provided by this library.
setGeometry()
method is used to set up the geometry of the PyQt5 window it self.
Syntax : window.setGeometry(x, y, width, height)
Arguments : It takes 4 arguments :
1. X co-ordinate
2. Y co-ordinate
3. Width of the window to be set
4. Height of the window to be set
Below is the implementation of this method.
Code :
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import sys
class Window(QMainWindow):
def __init__( self ):
super ().__init__()
self .setWindowTitle( "Geometry" )
self .setGeometry( 100 , 60 , 1000 , 800 )
self .widget = QLabel( 'Hello' , self )
self .show()
App = QApplication(sys.argv)
window = Window()
sys.exit(App. exec ())
|
Output :
Last Updated :
26 Mar, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...