This commit is contained in:
Lukas Schulz 2020-12-20 00:56:40 +01:00
parent e01eff0857
commit 7adf75d0c4

View file

@ -35,6 +35,7 @@ artist_name=""
token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
font = ImageFont.load_default()
def get_track():
print('getting info')
@ -89,16 +90,15 @@ 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)
font = ImageFont.load_default()
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):
if(font.getsize(artist_name)[0]>160):
y = threading.Thread(target=scrolling_text,args=(artist_name,songinfo_offset_x,songinfo_offset_y))
def scrolling_text(text,offset_x=0,offset_y=0):
for i in range(160-ImageDraw.textlength(text)):
for i in range(160-font.getsize(text)[0]):
scrolled_text_canvas = Image.new('RGB', (10, 32), color = 'black')
scrolled_text = ImageDraw.Draw(scrolled_text)
scrolled_text.text((-i,0), text)