Friday, September 5, 2025
HomeLanguagesSet title of window in PyQt5 – setWindowTitle

Set title of window in PyQt5 – setWindowTitle

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 – 
 

Python3




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


Output : 
 

set-window-title-pyqt

 

RELATED ARTICLES

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6634 POSTS0 COMMENTS
Nicole Veronica
11801 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11861 POSTS0 COMMENTS
Shaida Kate Naidoo
6750 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6698 POSTS0 COMMENTS
Umr Jansen
6718 POSTS0 COMMENTS