PySide2 – How to create window?
PySide2 is one of the most famous libraries in python for building GUI applications. In this article, we will build an empty window using PySide2 Library.
Steps to create empty window :
1. Import PySide2 in your code
2. Create QApplication object
3. Create object for QWidget
4. Increase the size of the window.
4. Show window using show() function
Python3
import sys
from PySide2.QtWidgets import QApplication, QWidget
app = QApplication(sys.argv)
mainwindow = QWidget()
mainwindow.resize( 550 , 400 )
mainwindow.setWindowTitle( 'GeeksForGeeks' )
mainwindow.show()
app.exec_()
|
As we execute this program, a new empty window of size 550*400 will pop up on your screen with the label ‘GeeksforGeeks’.
Output:
Last Updated :
04 Oct, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...