PROBLEM


I want to display an image from a pre-prepared buffer.


SOLUTION


from microbit import *

i = Image(5,5,b'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08')

display.show(i)


NOTES


1. The documentation for Image() is here:


http://microbit-micropython.readthedocs.io/en/latest/image.html?#classes


2. You can't use keyword arguments with this function.


3. The buffer parameter must support the buffer protocol - i.e. a bytearray or a string of bytes. You can't pass a Python list to this method.