[PyQt] Question about QCalendarWidget

Cesar Otero hfrequency at gmail.com
Mon Apr 14 16:03:46 BST 2008

Greetings to all:

I've been having some problems with the QCalendarWidget, which is very
nice, but seems to lack some documentation. I tried googling and
looking through many mail lists, but still can't find the solution to
my problem. I have the following code:

dateStr = "20070101" # january 1, 2007
date = QDate.fromString(dateStr, QString("yyyymmdd"))

But, the calendar does not change the month,year, or day. After the
calendar is rendered, the current date is displayed, not the selected
date. I can force it to change the displayed
month and year, but not the day with the following code...

calendar.setCurrentPage(2007, 01)

If I call the method showSelectedDate, the current day is displayed
instead. Am I actually changing the selectedDate or do I have to do
something else?
Also, what method do I use so that the day(1,2,3...31) is highlighted?
Is there some sort of 'update' method which will redraw the calendar
with the new selectedDate?


More information about the PyQt mailing list