Popular Python recipes tagged "calendar"http://code.activestate.com/recipes/langs/python/tags/calendar/2017-06-19T18:22:01-07:00ActiveState Code RecipesCreate Calendars on PDF with a few lines (Python)
2017-06-13T10:57:34-07:00Jorj X. McKiehttp://code.activestate.com/recipes/users/4193772/http://code.activestate.com/recipes/580805-create-calendars-on-pdf-with-a-few-lines/
<p style="color: grey">
Python
recipe 580805
by <a href="/recipes/users/4193772/">Jorj X. McKie</a>
(<a href="/recipes/tags/calendar/">calendar</a>, <a href="/recipes/tags/fitz/">fitz</a>, <a href="/recipes/tags/mupdf/">mupdf</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pymupdf/">pymupdf</a>).
Revision 2.
</p>
<p>PyMuPDF (fitz) provides easy to use ways to create PDF documents out of simple texts.</p>
<p>An example is the text output of Python's calendar module. Here we take a starting year as script parameter and output a 3-page (A4 landscape) document with calendars for this and the following two years - in less than 20 lines of code.</p>
Tkinter Datepicker (like the jQuery UI datepicker) (Python)
2017-06-19T18:22:01-07:00Miguel Martínez Lópezhttp://code.activestate.com/recipes/users/4189907/http://code.activestate.com/recipes/580725-tkinter-datepicker-like-the-jquery-ui-datepicker/
<p style="color: grey">
Python
recipe 580725
by <a href="/recipes/users/4189907/">Miguel Martínez López</a>
(<a href="/recipes/tags/calendar/">calendar</a>, <a href="/recipes/tags/datepicker/">datepicker</a>, <a href="/recipes/tags/megawidget/">megawidget</a>, <a href="/recipes/tags/tkinter/">tkinter</a>).
Revision 18.
</p>
<p>It's based on ttkcalendar.py. But the internals are totally changed.I don't use for example the Treeview widget. I added more features also:</p>
<ul>
<li>On mouse over, the day label changes the background</li>
<li>The selected day has an outstanding style</li>
<li>Added support for many hotkeys</li>
</ul>
<p>These are the default bindings:</p>
<ul>
<li><p><em>Click button 1 on entry:</em> Show calendar</p></li>
<li><p><em>Click button 1 outside entry and calendar:</em> Hide calendar</p></li>
<li><p><em>Escape:</em> Hide calendar</p></li>
<li><p><em>CTRL + PAGE UP:</em> Move to the previous month.</p></li>
<li><p><em>CTRL + PAGE DOWN:</em> Move to the next month.</p></li>
<li><p><em>CTRL + SHIFT + PAGE UP:</em> Move to the previous year.</p></li>
<li><p><em>CTRL + SHIFT + PAGE DOWN:</em> Move to the next year.</p></li>
<li><p><em>CTRL + LEFT:</em> Move to the previous day.</p></li>
<li><p><em>CTRL + RIGHT:</em> Move to the next day.</p></li>
<li><p><em>CTRL + UP:</em> Move to the previous week.</p></li>
<li><p><em>CTRL + DOWN:</em> Move to the next week.</p></li>
<li><p><em>CTRL + END:</em> Close the datepicker and erase the date.</p></li>
<li><p><em>CTRL + HOME:</em> Move to the current month.</p></li>
<li><p><em>CTRL + SPACE:</em> Show date on calendar</p></li>
<li><p><em>CTRL + Return:</em> Set current selection to entry</p></li>
</ul>
Create simple PDF text calendars with xtopdf (Python)
2014-02-14T22:33:04-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/578832-create-simple-pdf-text-calendars-with-xtopdf/
<p style="color: grey">
Python
recipe 578832
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/calendar/">calendar</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/reportlab/">reportlab</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>).
</p>
<p>This recipe shows how to create simple text calendars as PDF using xtopdf, a Python toolkit for PDF creation.</p>
Calendar Maker (Python)
2012-07-03T05:23:57-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578187-calendar-maker/
<p style="color: grey">
Python
recipe 578187
by <a href="/recipes/users/2608421/">Stephen Chappell</a>
(<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/calendar/">calendar</a>, <a href="/recipes/tags/cgi/">cgi</a>, <a href="/recipes/tags/old/">old</a>).
</p>
<p>This is an old program experimenting with CGI techniques in Python using <code>CGIHTTPServer</code> and designed for creating calendars. This is committed for archival to be run under Python 2.5 or later versions.</p>
Perpetual calendar (Python)
2011-04-15T20:44:54-07:00sundanceriddlehttp://code.activestate.com/recipes/users/4177681/http://code.activestate.com/recipes/577657-perpetual-calendar/
<p style="color: grey">
Python
recipe 577657
by <a href="/recipes/users/4177681/">sundanceriddle</a>
(<a href="/recipes/tags/binary/">binary</a>, <a href="/recipes/tags/calendar/">calendar</a>).
</p>
<p>Represents the so-called "perpetual clock" ( <a href="http://www.evilmadscientist.com/article.php/perpetualcalendar" rel="nofollow">http://www.evilmadscientist.com/article.php/perpetualcalendar</a> ) with numbers instead of pennies. Thinking about making a simple window with heads/tails images.</p>
Calculate Easter (Western) given a year (Python)
2008-09-30T10:35:59-07:00Martin Diershttp://code.activestate.com/recipes/users/4167352/http://code.activestate.com/recipes/576517-calculate-easter-western-given-a-year/
<p style="color: grey">
Python
recipe 576517
by <a href="/recipes/users/4167352/">Martin Diers</a>
(<a href="/recipes/tags/calendar/">calendar</a>, <a href="/recipes/tags/easter/">easter</a>).
</p>
<p>An implementation of <a href="http://www.smart.net/~mmontes/nature1876.html">Butcher's Algorithm</a> for determining the date of Easter for the Western church. Works for any date in the Gregorian calendar (1583 and onward). Returns a date object. </p>
Liturgical Calendar Year class (Python)
2008-09-30T16:57:29-07:00Martin Diershttp://code.activestate.com/recipes/users/4167352/http://code.activestate.com/recipes/576518-liturgical-calendar-year-class/
<p style="color: grey">
Python
recipe 576518
by <a href="/recipes/users/4167352/">Martin Diers</a>
(<a href="/recipes/tags/calendar/">calendar</a>, <a href="/recipes/tags/church/">church</a>).
</p>
<p>When initialized with a <code>year</code>, returns a class with a number of date attributes corresponding to common feasts of the western liturgical calendar. Number of Sundays after Epiphany and Trinity / Pentecost are also calculated, and stored in attributes. If the optional parameter <code>v2</code> is set to True, the calendar will return a post-Vatican II calendar which changes the date of Transfiguration Sunday, and the number of Sundays after Epiphany. In either case, the pre-Lent Sundays and Sundays after Pentecost will be set.</p>
<p><strong>Note:</strong> The <code>year</code> parameter is the year of the First Sunday in Advent - the beginning of the church year, and the resulting calendar thus ends in the following year.</p>