Year calendar creation in Python
Project description
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.8+
Installation
pipx install pyearcal
Usage
- Prepare a directory with 12 images (different image providers are planned)
- Initialize calendar with all options.
- Language (locales for English, Czech, Slovak, Italian)
- Special days (national holidays are included + add your own)
- Fonts, colours
- 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
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-2023.0.0.tar.gz
(15.6 kB
view details)
Built Distribution
File details
Details for the file pyearcal-2023.0.0.tar.gz
.
File metadata
- Download URL: pyearcal-2023.0.0.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 333fa5b8ae3e92735551f130504ec70a667dc60f5783f94588467e97337b4baf |
|
MD5 | 4c44b864e766eaa666443723b343d0e6 |
|
BLAKE2b-256 | 4e330ab1cc8e62ad8f6b22cc68ae32e2210a2affe2bfe80d1d630f3ddfb9b5ca |
File details
Details for the file pyearcal-2023.0.0-py3-none-any.whl
.
File metadata
- Download URL: pyearcal-2023.0.0-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 101078f0e8994289e76ae113e0a7b0bd309b6d67c2ac55b93a1a1e9672d68d6b |
|
MD5 | 6a73eed30a644595650ccb5158f0428f |
|
BLAKE2b-256 | cf3b8175af76993b7c9830e5afc0d9ea159642f8e1f61e37999494838c70880e |