From f5387307587766fd28eff9b479b6d1d29789af5f Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 12 May 2023 16:20:52 +0800 Subject: [PATCH] display top 10 or 20 golfers --- stockTicker.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/stockTicker.py b/stockTicker.py index 4c8f358..beaa7d7 100755 --- a/stockTicker.py +++ b/stockTicker.py @@ -3205,7 +3205,7 @@ class StockTicker(): imgs = [title_img, self.blank] else: imgs = [] - + ten_or_twenty = slice(None) for league in leagues: try: @@ -3215,10 +3215,26 @@ class StockTicker(): if league == 'PGA': league_logo = Image.open('logos/sports/league_logos/pga_1.png').convert('RGB') + try: + if all_settings['top20'] == 10: + ten_or_twenty = slice(10) + else: + ten_or_twenty = slice(None) + except: + ten_or_twenty = slice(None) elif league == 'LPGA': league_logo = Image.open('logos/sports/league_logos/lpga_1.png').convert('RGB') + try: + if all_settings['top20'] == 10: + ten_or_twenty = slice(10) + else: + ten_or_twenty = slice(None) + except: + ten_or_twenty = slice(None) else: league_logo = Image.open('logos/sports/league_logos/{}.png'.format(league)).convert('RGB') + ten_or_twenty = slice(None) + img.paste(league_logo, (x_offset,0)) x_offset += league_logo.size[0] +self.blank.size[0] @@ -3235,7 +3251,7 @@ class StockTicker(): pass buff_size = 20 - for team in team_info: + for team in team_info[ten_or_twenty]: if league == 'PGA' or league =='LPGA': pga_font = ImageFont.load("./fonts/7x14.pil") pga_small = ImageFont.load("./fonts/5x8.pil")