Changed panel layout

This commit is contained in:
spla 2020-12-05 17:58:32 +01:00
pare 72dfa742d7
commit 8cce92eae8

Veure arxiu

@ -46,11 +46,15 @@ def create_panel(username, played_games, wins):
fons = Image.open('app/panel/fons.jpg') fons = Image.open('app/panel/fons.jpg')
print(fons.size) print(fons.size)
large, high = fons.size
title_length = len(panel_title_str + ' ' + username)
# add chess icon # add chess icon
icon_path = 'app/panel/chess.png' icon_path = 'app/panel/chess.png'
icon_img = Image.open(icon_path) icon_img = Image.open(icon_path)
fons.paste(icon_img, (y+350, x+50), icon_img) fons.paste(icon_img, (y+300, x+50), icon_img)
logo_img = Image.open('app/panel/logo.png') logo_img = Image.open('app/panel/logo.png')
fons.paste(logo_img, (15, 320), logo_img) fons.paste(logo_img, (15, 320), logo_img)
@ -63,9 +67,9 @@ def create_panel(username, played_games, wins):
# get a drawing context # get a drawing context
draw = ImageDraw.Draw(txt) draw = ImageDraw.Draw(txt)
draw.text((y+200,x+20), panel_title_str + ' ' + username, font=fnt, fill=(255,255,255,220)) #fill=(255,255,255,255)) ## full opacity draw.text((((large / 2) - (title_length * 2)),x+20), panel_title_str + ' ' + username, font=fnt, fill=(255,255,255,220)) #fill=(255,255,255,255)) ## full opacity
fnt = ImageFont.truetype('app/fonts/DroidSans.ttf', 25, layout_engine=ImageFont.LAYOUT_BASIC) fnt = ImageFont.truetype('app/fonts/DroidSans.ttf', 35, layout_engine=ImageFont.LAYOUT_BASIC)
draw.text((y+70,x+120), panel_games_str + ': ' + str(played_games), font=fnt, fill=(255,255,255,220)) #fill=(255,255,255,255)) ## full opacity draw.text((y+70,x+120), panel_games_str + ': ' + str(played_games), font=fnt, fill=(255,255,255,220)) #fill=(255,255,255,255)) ## full opacity
draw.text((y+70,x+170), panel_wins_str + ': ' + str(wins), font=fnt, fill=(255,255,255,220)) #fill=(255,255,255,255)) ## full opacity draw.text((y+70,x+170), panel_wins_str + ': ' + str(wins), font=fnt, fill=(255,255,255,220)) #fill=(255,255,255,255)) ## full opacity