This commit is contained in:
Lukas Schulz 2020-12-20 01:31:43 +01:00
parent cf301b54d3
commit 06d23ca3e2

View file

@ -98,7 +98,7 @@ def drawCanvas():
#scrolling_text(song_name,songinfo_offset_x, songinfo_offset_y+10) #scrolling_text(song_name,songinfo_offset_x, songinfo_offset_y+10)
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), daemon=True) x = threading.Thread(target=scrolling_text,args=(song_name,songinfo_offset_x,songinfo_offset_y+10))
x.start() x.start()
print('scrolling text started') print('scrolling text started')
if(font.getsize(artist_name)[0]>160): if(font.getsize(artist_name)[0]>160):
@ -111,7 +111,7 @@ def drawCanvas():
def scrolling_text(text,offset_x=0,offset_y=0): def scrolling_text(text,offset_x=0,offset_y=0):
for i in range(font.getsize(text)[0]-160): for i in range(font.getsize(text)[0]-160):
scrolled_text_canvas = Image.new('RGB', (160, 32), color = 'black') scrolled_text_canvas = Image.new('RGB', (160, 10), color = 'black')
scrolled_text = ImageDraw.Draw(scrolled_text_canvas) scrolled_text = ImageDraw.Draw(scrolled_text_canvas)
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)
@ -119,7 +119,7 @@ def scrolling_text(text,offset_x=0,offset_y=0):
#print('scrolled '+str(i)+' px') #print('scrolled '+str(i)+' px')
time.sleep(2) time.sleep(2)
for i in range(font.getsize(text)[0]-160): for i in range(font.getsize(text)[0]-160):
scrolled_text_canvas = Image.new('RGB', (160, 32), color = 'black') scrolled_text_canvas = Image.new('RGB', (160, 10), color = 'black')
scrolled_text = ImageDraw.Draw(scrolled_text_canvas) scrolled_text = ImageDraw.Draw(scrolled_text_canvas)
scrolled_text.text(((-(font.getsize(text)[0]-160))+i+1,0), text) scrolled_text.text(((-(font.getsize(text)[0]-160))+i+1,0), text)
showImage(scrolled_text_canvas, offset_x, offset_y) showImage(scrolled_text_canvas, offset_x, offset_y)