This commit is contained in:
Lukas Schulz 2020-12-20 00:53:44 +01:00
parent b550e2d703
commit 803aeb696c

View file

@ -2,7 +2,7 @@ import sys
import spotipy import spotipy
import spotipy.util as util import spotipy.util as util
import config as cfg import config as cfg
from PIL import Image, ImageDraw from PIL import Image, ImageDraw, ImageFont
import asyncio import asyncio
from rgbmatrix import RGBMatrix, RGBMatrixOptions from rgbmatrix import RGBMatrix, RGBMatrixOptions
import threading 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+10), song_name)
songinfo.text((songinfo_offset_x,songinfo_offset_y), artist_name) songinfo.text((songinfo_offset_x,songinfo_offset_y), artist_name)
showImage(canvas) showImage(canvas)
scrolled_text_canvas = Image.new('RGB', (10, 32), color = 'black') font = ImageFont.truetype()
scrolled_text = ImageDraw.Draw(scrolled_text) if(font.getsize(song_name)[0]>160):
if(scrolled_text.textlength(song_name)>160):
x = threading.Thread(target=scrolling_text,args=(song_name,songinfo_offset_x,songinfo_offset_y+10)) x = threading.Thread(target=scrolling_text,args=(song_name,songinfo_offset_x,songinfo_offset_y+10))
if(ImageDraw.textlength(artist_name)>160): if(ImageDraw.textlength(artist_name)>160):
y = threading.Thread(target=scrolling_text,args=(artist_name,songinfo_offset_x,songinfo_offset_y)) y = threading.Thread(target=scrolling_text,args=(artist_name,songinfo_offset_x,songinfo_offset_y))