InkyPhat - Loop causes new info to display on top of old info


I have some Python that runs in an infinite loop.

It scrapes some info from the web.
Displays it on InkyPhat
Sleeps for 20 seconds
Goes back to the start

However, it ends up printing the new info over the top of the old info, leading to screen corruption.

How can I get it to wipe the screen before printing the new stuff?

When i run the program repeatedly on demand with no loop, it doesn’t do this, and it says “Shutting down display” each time. However, when I loop it doesn’t do this.


Have a look at this and see if it helps: InkyPhat - clear/clean screen or buffer
Hopefully that should do what you require?

Thanks. I get the concept, but I’m not sure how to draw a full screen rectangle?

inkyphat.rectangle(xy, fill=None, outline=None)

What are x and y?

Edit: Sussed it:

inkyphat.rectangle([(0, 0), (212, 104)], fill=inkyphat.WHITE, outline=None)

1 Like

Glad to see!
Yes, I’m not familiar with the Inkyphat library, but if it follows standard conventions, those x and y should be the co-ordinates of the upper left most corner. :)

i use this code (from another post in the forum) to completely refresh the screen.

inkyphat.paste('P', (inkyphat.WIDTH, inkyphat.HEIGHT)))

My screen is basically useless now because of all the tearing, but it probably has nothing to do with it.

1 Like

Tearing? What do you mean?

I didn’t take a picture before sending it back, but there’s a whole thread about it, where some of us have the screen deteriorating over time. It happens pretty quickly.