Open In App

PyQt5 QCalendarWidget – Setting Direction Property

Last Updated : 14 Dec, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

In this article we will see how we can set the direction of the QCalendarWidget. There are three type of direction available in the calendar, first is the default one which is left to right, second is right-to-left layouts which are necessary for certain languages, notably Arabic and Hebrew. Third is LayoutDirectionAuto serves two purposes. When used in conjunction with other objects, it will imply to use the layout direction set on the parent widget or QApplication.

In order to do this we will use setLayoutDirection method with the QCalendarWidget object.
Syntax : calendar.setLayoutDirection(direction)
Argument : It takes direction object as argument
Return : It return None 
 

Below is the implementation  

Python3




# importing libraries
from PyQt5.QtWidgets import *
from PyQt5 import QtCore, QtGui
from 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, 650, 400)
 
        # calling method
        self.UiComponents()
 
        # showing all the widgets
        self.show()
 
    # method for components
    def UiComponents(self):
 
        # creating a QCalendarWidget object
        self.calendar = QCalendarWidget(self)
 
        # setting geometry to the calendar
        self.calendar.setGeometry(50, 10, 400, 250)
 
        # setting cursor
        self.calendar.setCursor(Qt.PointingHandCursor)
 
        # setting direction
        self.calendar.setLayoutDirection(Qt.RightToLeft)
 
     
 
# create pyqt5 app
App = QApplication(sys.argv)
 
# create the instance of our Window
window = Window()
 
# start the app
sys.exit(App.exec())


Output : 

 



Similar Reads

PyQt5 QCalendarWidget - Getting Direction Property
In this article we will see how we can get the direction of the QCalendarWidget. There are three type of direction available in the calendar, first is the default one which is left to right, second is right-to-left layouts which are necessary for certain languages, notably Arabic and Hebrew. Third is LayoutDirectionAuto serves two purposes. When us
2 min read
PyQt5 QCalendarWidget - Unsetting Direction Property
In this article we will see how we can unset the direction property of the QCalendarWidget. There are three type of direction available in the calendar, first is the default one which is left to right, second is right-to-left layouts which are necessary for certain languages, notably Arabic and Hebrew. Third is LayoutDirectionAuto serves two purpos
2 min read
PyQt5 QCalendarWidget - Setting Visible Property Status
In this article we will see how we can make QCalendarWidget visible and invisible, by making the visible property False we can make it invisible. We can make it visible with the help of show method but this method will not make it invisible therefore we use visible property that can do both. In order to do this we will use setVisible method with th
1 min read
PyQt5 QCalendarWidget - Setting Window Modified property
In this article we will see how we can set the window modified property of QCalendarWidget. Window modified property holds whether the calendar shown in the window has unsaved changes or not, by default this property is False although we can change this.Note : If a QCalendarWidget is set as modified, all its ancestors will also be set as modified.
1 min read
PyQt5 QCalendarWidget - Setting accept drops property
In this article we will see how we can set the accept drop property of the QCalendarWidget. We know we can make drag enabled using setDragEnabled method with calendar object, but what is the use of dragging the text we can’t drop it anywhere. Allowing accept drop means that calendar has a property now to accept the drop text of the other calendar w
2 min read
PyQt5 QCalendarWidget - Setting Description Property
In this article we will see how we can set the description property of the QCalendarWidget. Description property hold the details about the calendar i.e all the details like how it is made and important things related to it. In order to do this we will use setAccessibleDescription method with the QCalendarWidget object. Syntax : calendar.setAccessi
1 min read
PyQt5 QCalendarWidget -Setting name property
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 QCale
1 min read
PyQt5 QCalendarWidget - Setting Property
In this article we will see how we can set properties information to the QCalendarWidget, properties are the information added by the developer to tell about the properties of the calendar, for example if calendar has a blocked future date, developer will add this property so that other developer can see this and get to know about the property. In
2 min read
PyQt5 QCalendarWidget - Setting Date Edit (Pop-Up) Accept Delay Property
In this article, we will see how we can set/change the date edit accept delay property of the QCalendarWidget. This property holds the time an inactive date edit is shown before its contents are accepted. If the calendar widget's date edit is enabled, this property specifies the amount of time (in milliseconds) that the date edit remains open after
2 min read
PyQt5 QCalendarWidget - Setting Edit Focus Property
In this article we will see how we can set the edit focus to the QCalendarWidget. If this property is enabled it make the calendar to have edit focus, in which case Qt::Key_Up and Qt::Key_Down will be delivered to the calendar normally; otherwise, Qt::Key_Up and Qt::Key_Down are used to change focus. Note : This feature is only available in Qt for
2 min read