rpi-rgb-led-matrix icon indicating copy to clipboard operation
rpi-rgb-led-matrix copied to clipboard

Help avoiding overlapping text

Open fofusion opened this issue 3 years ago • 4 comments

Hi,

I'm making fairly good progress getting this great library to work, but I'm completely lost about how to prevent overlapping static/scrolling text and wondering if anyone has been able to figure this out.

Basically, I want my board to flip through various things such as weather/train times etc and I'm trying to have some scrolling text from right to left which some static text before it in the first 1/3rd of the row.

Eg: Calling at: <<< SCROLLING SECTION RIGHT TO LEFT >>>

With 'Calling at' being static text.

The issue I have is that the scrolling text overlaps the static piece until it spills over the edge of the display.

I guess the key to this is to find a way to have the text start 'erasing' itself a pixel at a time once it reaches a certain part of the screen so that it doesn't overlap the 'Calling at' section.

Has anyone had any joy with something like this?

My code is here.

Appreciate any help!

fofusion avatar Apr 27 '22 09:04 fofusion

Draw a rectangle underneath the static text (in my case, the pause button), but above the scrolling text layer. I made it red for this example, but you'd match it to your background color. Screen Shot 2022-05-09 at 2 47 54 PM

kylejohnsonkj avatar May 09 '22 20:05 kylejohnsonkj

Thanks for the reply @kylejohnsonkj !

Forgive my ignorance, but I presume we're talking about setting up pygame and installing the pgmatrix library so that I can utilise pygame with this adapter to draw out areas on screen?

Does this generate the code I require or would I then be running it from pygame?

Sorry, I've not utilised this before and I'm not seeing much in the way of resources online to help me get to that stage.

Thanks!

fofusion avatar May 11 '22 08:05 fofusion

You can use the PIL library to draw shapes. This example should be helpful: https://github.com/hzeller/rpi-rgb-led-matrix/blob/master/bindings/python/samples/image-draw.py

And sorry to confuse. That pygame window is just the output of a matrix emulator I use to make development easier. It's a drop in substitute for this library.

kylejohnsonkj avatar May 11 '22 22:05 kylejohnsonkj

Thanks for the link, that's super helpful. I'll take a look

(Sorry for my slow reply!)

fofusion avatar May 31 '22 12:05 fofusion