This commit is contained in:
Lukas Schulz 2020-12-20 00:46:17 +01:00
parent 75d393fdf6
commit 523f413af2

21
main.py
View file

@ -84,12 +84,25 @@ def drawCanvas():
canvas = Image.new('RGB', (192, 128), color = 'black')
canvas.paste(get_track(),(0,96))
songinfo = ImageDraw.Draw(canvas)
songinfo.text((33,111), song_name)
songinfo.text((33,101), artist_name)
songinfo_offset_x = 33
songinfo_offset_y = 101
songinfo.text((songinfo_offset_x,songinfo_offset_y+10), song_name)
songinfo.text((songinfo_offset_x,songinfo_offset_y), artist_name)
showImage(canvas)
if(ImageDraw.textlength(song_name)>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))
def scrolling_text(text,offset_x=0,offset_y=0):
for i in range(160-ImageDraw.textlength(text)):
scrolled_text_canvas = Image.new('RGB', (10, 32), color = 'black')
scrolled_text = ImageDraw.Draw(scrolled_text)
scrolled_text.text((-i,0), text)
showImage(canvas, offset_x, offset_y)
if __name__ == "__main__":
#main()
print('text')
@ -99,4 +112,6 @@ if __name__ == "__main__":
time.sleep(10)