In this article we will see how we can set the name property of the QCalendarWidget.Name property hold the name of the calendar, name is used to distinguish the calendar with each other i.e categorize them according to the use, for example, birth calendar, booking calendar etc.
In order to do this we will use setAccessibleName method with the QCalendarWidget object.Â
Syntax : calendar.setAccessibleName(text)Â
Argument : It takes string as argumentÂ
Action Performed : It return None
Below is the implementationÂ
Python3
# importing librariesfrom PyQt5.QtWidgets import *from PyQt5 import QtCore, QtGuifrom PyQt5.QtGui import *from PyQt5.QtCore import *import sysÂ
Â
class Window(QMainWindow):Â
    def __init__(self):        super().__init__()Â
        # setting title        self.setWindowTitle("Python ")Â
        # setting geometry        self.setGeometry(100, 100, 600, 400)Â
        # calling method        self.UiComponents()Â
        # showing all the widgets        self.show()Â
    # method for components    def UiComponents(self):Â
        # creating a QCalendarWidget object        calendar = QCalendarWidget(self)Â
        # setting geometry to the calendar        calendar.setGeometry(10, 10, 400, 250)Â
        # setting name        calendar.setAccessibleName("Geek Calendar")Â
        # create pyqt5 appApp = QApplication(sys.argv)Â
# create the instance of our Windowwindow = Window()Â
# start the appsys.exit(App.exec()) |
Output :
Â

