diff --git a/main.py b/main.py index 30a023b..6eb3c87 100644 --- a/main.py +++ b/main.py @@ -2,7 +2,7 @@ import sys import spotipy import spotipy.util as util import config as cfg -from PIL import Image, ImageDraw +from PIL import Image, ImageDraw, ImageFont import asyncio from rgbmatrix import RGBMatrix, RGBMatrixOptions import threading @@ -89,9 +89,8 @@ def drawCanvas(): songinfo.text((songinfo_offset_x,songinfo_offset_y+10), song_name) songinfo.text((songinfo_offset_x,songinfo_offset_y), artist_name) showImage(canvas) - scrolled_text_canvas = Image.new('RGB', (10, 32), color = 'black') - scrolled_text = ImageDraw.Draw(scrolled_text) - if(scrolled_text.textlength(song_name)>160): + font = ImageFont.truetype() + if(font.getsize(song_name)[0]>160): x = threading.Thread(target=scrolling_text,args=(song_name,songinfo_offset_x,songinfo_offset_y+10)) if(ImageDraw.textlength(artist_name)>160): y = threading.Thread(target=scrolling_text,args=(artist_name,songinfo_offset_x,songinfo_offset_y))