Skip to main content

Year calendar creation in Python

Project description

Latest Version

pyearcal

Generate your year calendar in Python. The result is a PDF file with 12 pages containing an image and a grid of days.

Requirements

  • pillow or PIL
  • reportlab
  • DejaVu fonts (if you want pyearcal work out of the box)
  • BeautifulSoup (optional)
  • Python 3.6+

Usage

  1. Prepare a directory with 12 images (different image providers are planned)
  2. Initialize calendar with all options.
    • Language (locales for English, Czech, Slovak, Italian)
    • Special days (national holidays are included + add your own)
    • Fonts, colours
  3. Render it to PDF

Usage of the script

Usage: pyearcal [OPTIONS] [OUTPUT]

Options:
  -s, --source PATH
  -l, --locale [en|cs|it|sk]
  -y, --year INTEGER
  -f, --font TEXT
  -d, --special-days TEXT

Example code

# Import important modules
from pyearcal import YearCalendar
from pyearcal.image_sources import UnsortedImageDirectory
from datetime import date
from pyearcal.l10n import CzechLocale

year = date.today().year + 1

# Use all pictures from "images" directory
image_source = UnsortedImageDirectory("images")

# Use Czech locale and holidays
locale = CzechLocale()

# Set a few special days
special_days = [
    date(year, 1, 31) # Guido van Rossum's birthday
]

calendar = YearCalendar(year, image_source, locale, special_days)
calendar.render("calendar.pdf")

You can take FlickrDownloader as an inspiration for developing a more sophisticated image source.

Example with real pictures

India Faces Calendar 2014 (80 MB)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyearcal-2021.0.1.tar.gz (14.6 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page