This commit is contained in:
Lukas Schulz 2020-12-20 01:50:32 +01:00
parent c5611f889f
commit 3340507cd6

View file

@ -110,7 +110,7 @@ def drawCanvas():
def scrolling_text(text,offset_x=0,offset_y=0): def scrolling_text(text,offset_x=0,offset_y=0):
scroll_frame_time = (font.getsize(text)[0]-160)/(10/2) scroll_frame_time = (10/2)/(font.getsize(text)[0]-160)
if(scroll_frame_time<0.1): if(scroll_frame_time<0.1):
scroll_frame_time = 0.1 scroll_frame_time = 0.1
for i in range(font.getsize(text)[0]-160): for i in range(font.getsize(text)[0]-160):
@ -120,9 +120,8 @@ def scrolling_text(text,offset_x=0,offset_y=0):
showImage(scrolled_text_canvas, offset_x, offset_y) showImage(scrolled_text_canvas, offset_x, offset_y)
time.sleep(scroll_frame_time) time.sleep(scroll_frame_time)
#print('scrolled '+str(i)+' px') #print('scrolled '+str(i)+' px')
if((5-(font.getsize(text)[0]-160)*0.2)>0): if((5-(font.getsize(text)[0]-160)*2*scroll_frame_time)>0):
time.sleep(5-(font.getsize(text)[0]-160)*2*scroll_frame_time) time.sleep(5-(font.getsize(text)[0]-160)*2*scroll_frame_time)
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, 11), color = 'black') scrolled_text_canvas = Image.new('RGB', (160, 11), color = 'black')
scrolled_text = ImageDraw.Draw(scrolled_text_canvas) scrolled_text = ImageDraw.Draw(scrolled_text_canvas)