Qcalendar widget for Maya GUI using PyQt
December 7, 2009 Leave a comment
QCalendar widget is one of the handy widgets provided by PyQt that can be included in your maya custom UI for the user to deal with date information.Apart from providing current date information to the user, Qcalendar widget can be used to get valid date inputs from the user.It includes a set of signals like selectionChanged() and currentPageChanged() which can be used to update the information based on user selection.
The selected date can be retrieved using the method selectedDate() which will return a Qdate.The day() and month() methods of QDate can be used to get seperate day and month values. Similarly longMonthName() method can be used to get the long names of the month since the method month() gives the month in number format (12 for December).
The usage is as follows:
myDate = myCalendar.selectedDate()
month = myDate.month()
day = myDate.day()
monthName = myDate.longMonthName(myDate.month())
The calendar grid visibility can be set for east readability using the setGridVisible() method which will accept a boolean value.
myCalendar.setGridVisible(True)





