Skip to content
Related Articles

Related Articles

Improve Article

Set title of window in PyQt5 – setWindowTitle

  • Last Updated : 26 Mar, 2020

PyQt5 is a comprehensive set of Python bindings for Qt v5. It is implemented as more than 35 extension modules and enables Python to be used as an alternative application development language to C++ on all supported platforms including iOS and Android.

In this article, we will see how to set title of the window in PyQt5. In order to do so setWindowTitle() method is used, this method belongs to the QWidget class.

Syntax : self.setWindowTitle(title)

Argument : It takes title i.e string as argument.

Below is the Python implementation –

# importing the required libraries
from PyQt5.QtGui import * 
from PyQt5.QtWidgets import * 
import sys
class Window(QMainWindow):
    def __init__(self):
        # string value
        title = "Tile of window"
        # set the title
        # setting  the geometry of window
        self.setGeometry(0, 0, 500, 300)
        # show all the widgets
# create pyqt5 app
App = QApplication(sys.argv)
# create the instance of our Window
window = Window()
# start the app

Output :

 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

My Personal Notes arrow_drop_up
Recommended Articles
Page :