Skip to content

Commit

Permalink
add basic functionality for calculate days
Browse files Browse the repository at this point in the history
  • Loading branch information
kronicka committed Dec 21, 2018
1 parent 99e4dc1 commit e608314
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
from PIL import Image
from datetime import date


def calculate_days(*dob) -> int:
def calculate_days(*dob: int) -> int:
""" Calculate number of days left to live based on date of birth """
return 3
average_life_expectancy = 26098 # actually half a day above the average human life expectancy (71.5 yrs)
days_lived = abs(date.today() - date(*dob)).days
days_left = average_life_expectancy - days_lived

return days_left


def generate_calendar(days: int):
""" Generate a calendar based on the number of days """
# TODO: scale square pics based on the number of days
with Image.open('square.jpg') as square, Image.open('background.png') as background:
square_path = 'img/square.jpg'
background_path = 'img/background.png'
with Image.open(square_path) as square, Image.open(background_path) as background:
print(background.format, background.size, background.mode)

for day in range(days):
Expand All @@ -20,5 +27,5 @@ def generate_calendar(days: int):


if __name__ == '__main__':
days = calculate_days(10, 10, 1995)
generate_calendar(days)
days = calculate_days(1995, 10, 10)
# generate_calendar(days)
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit e608314

Please sign in to comment.