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
#1
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)
			time.sleep(0.3)
			for i in range(len(text) - num_cols + 1):
				text_to_print = text[i:i+num_cols]
				display.text(text_to_print, num_line)
				time.sleep(0.3)
			time.sleep(0.3)
		else:
			display.text(text, num_line)

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

    while True:
        time.sleep(0.1)

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



            if counter <= 0:
                break
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.
Reply


Messages In This Thread
raspberry use scrolling text two lines together - by fishbone - Sep-06-2021, 03:24 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Scrolling in Python newpyt 6 659 Nov-23-2023, 09:10 PM
Last Post: newpyt
  Editing text between two string from different lines Paqqno 1 1,287 Apr-06-2022, 10:34 PM
Last Post: BashBedlam
  Extracting Specific Lines from text file based on content. jokerfmj 8 2,866 Mar-28-2022, 03:38 PM
Last Post: snippsat
  Can Python be used to create scrolling credits (as follows) digger 3 2,822 Aug-27-2021, 03:15 PM
Last Post: Larz60+
  More elegant way to remove time from text lines. Pedroski55 6 3,840 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 2,823 Mar-24-2021, 05:45 AM
Last Post: buran
  Iterate 2 large text files across lines and replace lines in second file medatib531 13 5,707 Aug-10-2020, 11:01 PM
Last Post: medatib531
  How to scrolling Picture in x axis kalihotname 1 2,208 Jun-16-2020, 12:18 PM
Last Post: DeaD_EyE
  Read Multiples Text Files get specific lines based criteria zinho 5 3,053 May-19-2020, 12:30 PM
Last Post: zinho
  How to detect the text above lines using OpenCV in Python pframe 0 2,486 Apr-14-2020, 09:53 AM
Last Post: pframe

Forum Jump:

User Panel Messages

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