Closed ChristopherBadenhorst closed 5 years ago
with times height is the size of the area/matrix you want to clear:
for y in range(0, height): for x in range(0, width): matrix.SetPixel(x, y, 0, 0, 0)
@angelogoncalve Thanks for your help, I've tried a lot of variations with your piece of code but can't work it out. What is wrong here now?
def job2():
for y in range(0, 32):
for x in range(0, 64):
mseconds.SetPixel(0, 32, 0, 0, 0)
mseconds.Clear()
clock = datetime.datetime.now().strftime("%H:%M:%S")
graphics.DrawText(matrix, font3, 0, 55, blue, clock)
job2()
schedule.every(1).seconds.do(job2)
I do still want to rebuild it to just clear the area of the 'seconds', and make a seperate job for the minutes and a seperate job for the hours. But if I get this right, i'll get all of them right.
I suppse you want to casll SetPixel()
with x and y, no only 0, 32 ?.
Anyway, what you should do is to write the time into a second canvas, then do SwapOnVSync()
, otherwise this will result in flicker.
Yes Henner Zeller you arer correct:
def job2():
for y in range(0, 32):
for x in range(0, 64):
mseconds.SetPixel(x, y, 0, 0, 0)
The SwapOnVSync() made it more complicating for me. Solved it (quick and dirty) with drawing an image that is completely black, before writing the new time. Works very wel!
@ChristopherBadenhorst, if you've solved this, please consider closing this issue =)
Hi,
I'm making a clock with some other features. Now I want the clock to update every x time, and that works fine. I just can't figure out how to clear only the clock area and not the whole screen with every update of the clock.
I found:
matrix = RGBMatrix(options = options)
andmatrix.Clear()
I do think I can use
canvas.Clear()
for just an area. I just don't understand how I can define thecanvas =
area. Can anyone help?