summaryrefslogtreecommitdiff
path: root/tests/extmod/framebuf_subclass.py
blob: b429776bc2881aa4b044259b720783240530cf2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# test subclassing framebuf.FrameBuffer

try:
    import framebuf
except ImportError:
    print("SKIP")
    raise SystemExit


class FB(framebuf.FrameBuffer):
    def __init__(self, n):
        self.n = n
        super().__init__(bytearray(2 * n * n), n, n, framebuf.RGB565)

    def foo(self):
        self.hline(0, 2, self.n, 0x0304)


fb = FB(n=3)
fb.pixel(0, 0, 0x0102)
fb.foo()
print(bytes(fb))