Python Forum
raspberry use scrolling text two lines together
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
raspberry use scrolling text two lines together
Hello Everyone,

I connect the 16*2 lcd screen to my raspberry. I want to write two columns scrolling text on the lcd screen.

I use the below code for scrolling text. When I use this code on the two columns, start scrolling the first column after start scrolling the second column. How to synchronous scrolling two columns. I use delay class for time.sleep() but I didn't handle it. I also add the delay class below.

def long_string(display, text='', num_line=1, num_cols=16):
		Parameters: (driver, string to print, number of line to print, number of columns of your display)
		Return: This function send to display your scrolling string.
		if len(text) > num_cols:
			display.text(text[:num_cols], num_line)
			for i in range(len(text) - num_cols + 1):
				text_to_print = text[i:i+num_cols]
				display.text(text_to_print, num_line)
			display.text(text, num_line)

def delay1(counter):
    start1 = time.time()

    while True:

        if time.time() - start1 > 1:
            start1 = time.time()
            counter = counter - 1

            if counter <= 0:
Larz60+ write Sep-06-2021, 06:44 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Editing text between two string from different lines Paqqno 1 613 Apr-06-2022, 10:34 PM
Last Post: BashBedlam
  Extracting Specific Lines from text file based on content. jokerfmj 8 1,031 Mar-28-2022, 03:38 PM
Last Post: snippsat
  Can Python be used to create scrolling credits (as follows) digger 3 1,423 Aug-27-2021, 03:15 PM
Last Post: Larz60+
  More elegant way to remove time from text lines. Pedroski55 6 2,469 Apr-25-2021, 03:18 PM
Last Post: perfringo
  how to connect mysql from txt 1 line goes good but not all lines in text kingceasarr 4 1,790 Mar-24-2021, 05:45 AM
Last Post: buran
  Iterate 2 large text files across lines and replace lines in second file medatib531 13 3,582 Aug-10-2020, 11:01 PM
Last Post: medatib531
  How to scrolling Picture in x axis kalihotname 1 1,417 Jun-16-2020, 12:18 PM
Last Post: DeaD_EyE
  Read Multiples Text Files get specific lines based criteria zinho 5 2,069 May-19-2020, 12:30 PM
Last Post: zinho
  How to detect the text above lines using OpenCV in Python pframe 0 1,813 Apr-14-2020, 09:53 AM
Last Post: pframe
  Can't seem to figure out how to delete several lines from a text file Cosmosso 9 2,716 Dec-10-2019, 11:09 PM
Last Post: Cosmosso

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020