Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

cursor_position, redux - Raspberry Pi and LCD
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

cursor_position, redux - Raspberry Pi and LCD

by andrewa on Mon Mar 02, 2020 10:27 pm

There was an issue about setting the cursor position on the LCD in Python:

viewtopic.php?f=60&t=153478&p=759719&hilit=cursor_position#p759719

I found the 'Kludge' workaround:

https://github.com/adafruit/Adafruit_Ci ... /issues/21

... but the standard lcd.cursor_position(x,y) doesn't seem to work in the standard way:

lcd.cursor_position(0,0)
lcd.message("hello")

I've gotten the latest library, but was wondering if this was fixed. The Kludge option works from the link above, but it would be nice if this mirrored the usual usage of setting the cursor position, and then writing a message...


Code: Select all | TOGGLE FULL SIZE
def Kludge(col,row,txt):
    lcd.cursor_position(col,row)
    for c in txt:
        lcd._write8(ord(c),True)



use like this to write the string "hello" starting from the 4th char position on row 2 without touching anything else already displayed:

Kludge(3,1,'hello')

andrewa
 
Posts: 141
Joined: Mon Oct 19, 2009 9:53 pm

Re: cursor_position, redux - Raspberry Pi and LCD

by tannewt on Tue Mar 03, 2020 1:42 pm

What do you mean by the standard way? I'd expect this to work:
Code: Select all | TOGGLE FULL SIZE
lcd.cursor_position(0,0)
lcd.message = "hello"

tannewt
 
Posts: 1727
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.