aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/evergreen/duck_game.py
diff options
context:
space:
mode:
authorGravatar Cam Caswell <[email protected]>2021-07-09 13:36:08 -0400
committerGravatar Cam Caswell <[email protected]>2021-07-09 14:02:38 -0400
commit79db5a00dfe7639020174bd543fb10d1e789dace (patch)
tree3a0864e056c505a21d591f632ca177508935041c /bot/exts/evergreen/duck_game.py
parentTweaked minimum solution distribution (diff)
Improve the look of labels
Diffstat (limited to 'bot/exts/evergreen/duck_game.py')
-rw-r--r--bot/exts/evergreen/duck_game.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/bot/exts/evergreen/duck_game.py b/bot/exts/evergreen/duck_game.py
index fb54fcfd..7fb23ff6 100644
--- a/bot/exts/evergreen/duck_game.py
+++ b/bot/exts/evergreen/duck_game.py
@@ -8,7 +8,7 @@ from pathlib import Path
from urllib.parse import urlparse
import discord
-from PIL import Image, ImageDraw
+from PIL import Image, ImageDraw, ImageFont
from discord.ext import commands
from bot.bot import Bot
@@ -32,8 +32,11 @@ INCORRECT_GOOSE = -1
"""
SOLN_DISTR = 0, 0.05, 0.05, 0.1, 0.15, 0.25, 0.2, 0.15, .05
-p = Path("bot", "resources", "evergreen", "all_cards.png")
-ALL_CARDS = Image.open(p)
+image_path = Path("bot", "resources", "evergreen", "all_cards.png")
+font_path = Path("bot", "resources", "evergreen", "LuckiestGuy-Regular.ttf")
+
+ALL_CARDS = Image.open(image_path)
+LABEL_FONT = ImageFont.truetype(str(font_path), size=16)
CARD_WIDTH = 155
CARD_HEIGHT = 97
@@ -51,7 +54,12 @@ def assemble_board_image(board: list[tuple[int]], rows: int, columns: int) -> Im
row, col = divmod(idx, columns)
top, left = row * CARD_HEIGHT, col * CARD_WIDTH
new_im.paste(card_image, (left, top))
- draw.text((left+7, top+4), str(idx), (0, 0, 0)) # magic numbers are buffers for the card labels
+ draw.text(
+ xy=(left+5, top+5), # magic numbers are buffers for the card labels
+ text=str(idx),
+ fill=(0, 0, 0),
+ font=LABEL_FONT,
+ )
return new_im