This commit is contained in:
Lukas Schulz 2020-12-20 01:00:49 +01:00
parent 7b9e5d610a
commit f0b92c3038

View file

@ -92,8 +92,10 @@ def drawCanvas():
showImage(canvas) showImage(canvas)
if(font.getsize(song_name)[0]>160): if(font.getsize(song_name)[0]>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))
x.start()
if(font.getsize(artist_name)[0]>160): if(font.getsize(artist_name)[0]>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))
y.start()
@ -101,7 +103,7 @@ def scrolling_text(text,offset_x=0,offset_y=0):
for i in range(160-font.getsize(text)[0]): for i in range(160-font.getsize(text)[0]):
scrolled_text_canvas = Image.new('RGB', (10, 32), color = 'black') scrolled_text_canvas = Image.new('RGB', (10, 32), color = 'black')
scrolled_text = ImageDraw.Draw(scrolled_text) scrolled_text = ImageDraw.Draw(scrolled_text)
scrolled_text.text((i,0), text) scrolled_text.text((-i,0), text)
showImage(scrolled_text_canvas, offset_x, offset_y) showImage(scrolled_text_canvas, offset_x, offset_y)
time.sleep(1) time.sleep(1)
print('scrolled '+i) print('scrolled '+i)