-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (30 loc) · 1.42 KB
/
main.py
File metadata and controls
30 lines (30 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import json
from datetime import datetime
from PIL import Image, ImageDraw, ImageFont, ImageSequence
with open('personalData.json', 'r') as json_file:
infoFile = json.load(json_file)
first_info = infoFile['info'][0]
cDate = datetime.now()
date = int(first_info['dobDate'])
month = int(first_info['dobMonth'])
year = int(first_info['dobYear'])
bDate = datetime(year,month,date)
age = cDate.year - bDate.year - ((cDate.month, cDate.day)<(bDate.month, bDate.day))
first_info['age'] = str(age)
first_info['date'] = cDate.strftime('%d/%m/%Y')
with open('personalData.json', 'w') as json_file:
json.dump(infoFile, json_file, indent=3)
def med():
form = Image.open("medForm.png")
reqs = ['fullname', 'age', 'sex', 'date', 'mobileNumber', 'emailID', 'address', 'bloodGroup', 'diet', 'exercise', 'otherHabits', 'medicalHistory', 'drugAllergies', 'familyHistory']
x = [604, 604, 426, 455, 761, 568, 703, 665, 478, 568, 658, 732, 703, 689]
y = [609, 701, 793, 885, 1035, 1127, 1219, 1508, 1600, 1692, 1784, 1876, 1968, 2060]
h = [83, 83, 83, 83, 83, 83, 190, 83, 83, 83, 83, 83, 83, 83]
for i in range(0,14):
r = reqs[i]
font = ImageFont.truetype("Kantumruy_Pro\KantumruyPro-VariableFont_wght.ttf", 51)
edit = ImageDraw.Draw(form)
edit.text((x[i],y[i]+15), first_info[r], (0,0,12), font=font)
form.save("FmedForm.png")
form = Image.open("Fmedform.png")
med()