masood
masood

Reputation: 734

Show QCalendarWidget for Shamsi (Jalali) in Python and pyqt

I want to know QCalendarWidget(pyqt and in python) for Persian displayed What should I do?
Or any other language except the English(for example Persian, Arabic,Russian, etc)
Thanks

Upvotes: 3

Views: 2191

Answers (3)

Soroush Rabiei
Soroush Rabiei

Reputation: 10868

Short Answer

You can't. (Yet)

Long answer

Qt does not support calendars. There is a work-in-progress (code available here) to add non-Gregorian calendaring support for Qt in QtWidgets and QtQuick modules. If everything goes fine, the patch will be merged into Qt 5.11. It's stable enough for now, so you can apply it to Qt 5.10 source and you should be fine.

Disclaimer: I'm not aware of possible licensing issues (if you made changes to Qt, you may need to publish your source code[?]).

Important Notes:

Calendars and Locale are separated and unrelated concepts. This animated gif should elaborate more (it's an early test of our proposed change to Qt):

Image

Upvotes: 2

Iron Fist
Iron Fist

Reputation: 10951

You can change the language display in QCalenderWidget by changing the language in local properties to Persian using Qt

enter image description here

Output:

enter image description here

EDIT:

If you want to have calendars with Jalali and Hijri support, and persian translation, then you will have to install StarCalender package and use its library for such thing.

Here its source fourge link as well

Upvotes: 1

Achayan
Achayan

Reputation: 5885

cal = QtGui.QCalendarWidget()
cal.setLocale(QtCore.QLocale.Persian)

Upvotes: 1

Related Questions