Changed panel layout
This commit is contained in:
pare
72dfa742d7
commit
8cce92eae8
S'han modificat 1 arxius amb 8 adicions i 4 eliminacions
|
@ -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,13 +67,13 @@ 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
|
||||||
draw.text((y+70,x+220), panel_ratio_str + ': ' + str(ratio) + '%', font=fnt, fill=(255,255,255,220))
|
draw.text((y+70,x+220), panel_ratio_str + ': ' + str(ratio) + '%', font=fnt, fill=(255,255,255,220))
|
||||||
|
|
||||||
fnt = ImageFont.truetype('app/fonts/DroidSans.ttf', 15, layout_engine=ImageFont.LAYOUT_BASIC)
|
fnt = ImageFont.truetype('app/fonts/DroidSans.ttf', 15, layout_engine=ImageFont.LAYOUT_BASIC)
|
||||||
|
|
||||||
|
|
Loading…
Referencia en una nova incidència