diff --git a/main.py b/main.py index 0f9cf8c..34a9d75 100644 --- a/main.py +++ b/main.py @@ -110,7 +110,7 @@ def drawCanvas(): 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): scroll_frame_time = 0.1 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) time.sleep(scroll_frame_time) #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) - for i in range(font.getsize(text)[0]-160): scrolled_text_canvas = Image.new('RGB', (160, 11), color = 'black') scrolled_text = ImageDraw.Draw(scrolled_text_canvas)