Working with the calendar widget in PyQt4
I'm trying to create a small program that allows my wife to quickly select a date and then select the type of shift she had to work at the hospital. Here's an image:
The idea is that after she selects a date, a shift, and presses Save, the selected cell of the date is given a certain color to easily indicate that she's already selected a shift for that date. Then she continues to the next one, etc. (Even better would be if she could double-click the date after which a dropdown menu appears in the cell that allows her to select either d (for day), e (for evening), or n (for night), but that is way out of my league) programming-wise).
Finally, when she presses Excel or PDF, all her hours and irregular hours are displayed in a neat order. I already managed that last part with a boring old python console program. I wanted to spice it up with a fancy GUI and figured a calendar would do nicely.
I used the Qt Designer to create the layout and this is the output after using pyuic4: https://pastebin.com/raw/am9EeCcz (the file is called test.py)
Then I use this to run the program: https://pastebin.com/raw/y0zGEgJm (this file is called test2.py). The Save button is already able to gather the selected date and shift, but now it needs to colorize the selected date as well.
Thank you in advance!
Hi and welcome to devnet,
From a quick look at QCalendarWidget, you'll likely want to use setDateTextFormat to modify the appearance of a given date.
Hope it helps