This week I needed to quickly print out a calendar and although I could have used Visio’s built-in calendar shapes (which would have been both easier and produce better results) I instead decided to use this as an opportunity to show a real-world example of python’s calendar module in use.
The output is simple: just a grid as shown below. Days that fall out of the target month are shown with muted text.
You can download the .PY file called drawcalendarmonth.py in my Collection of IronPython scripts for Visio
IN COMPARISON TO THE BUILT-IN SHAPES
Again, Visio’s built in Calendar shapes provides much more useful output.
When you drag the Month shape into a drawing, you’ll get control over several aspects of what to show. As you can see below, it even lets you control the language to use.