Closed microbit-giles closed 3 years ago
I'm getting the same @Gadgetoid - it seems as if the display buffer might not be getting cleared properly on an inkybit.show()?
I couldn't figure out a way of clearing it in makecode - I tried adding inkybit.clear() into the Python code but that gets "can't find called function "inkybit.clear" and "module 'inkybit' has no attribute 'clear'"...
Hi, I'm having the same problem. I'm trying to change the text with different inputs but it's just layering up on the screen and I can only clear it by pressing reset. Calling clear() in the javascript on MakeCode doesn't work and show() isn't clearing the screen.
Sorry for the delay getting back to you on this one. I've made a silly, silly oversight in not including clear
and I'll get that fixed today.
I've added clear
in #2 but I'm thinking that rectangle
might be a little verbose for clearing update regions, even though this would normally be the canonical way to do it.
Something like clearRegion
or clearRectangle
that only accepts x/y and w/h would probably be handy for your purposes @microbit-giles
To clarify show()
will not clear the buffer for you, you must call clear()
(once this change is merged and published).
Thank you - yes clearRegion or clearRectangle would be very nice features if it would offer a speed advantage or if an updateRegion were possible. If you still have to update the whole screen I guess you might as well clear the whole display and reshow?
Unfortunately there's no regional update support on these displays as far as I'm aware. Being able to clear a region wouldn't offer much other than some way of simplifying your code- IE: you can draw all the common stuff just once.
pxt bump'd to 0.0.2 with clear()
and clearRectangle()
you can draw all the common stuff just once.
Ah, yes, that's worth having - often you want to draw labels but only update numbers, so this is worthwhile.
Clear rectangle working for me now: https://makecode.microbit.org/_KMfM1uE0u1qc
Whew! Awesome. Thank you.
Will it be possible to clear and/or update a rectangle? I made a temperature logger that updates the display every few minutes and noticed the digits get scrambled without clearing, so I wonder if it may be possible to clear only a portion of the display, or would it be best to draw a filled rectangle in the area of the digits?