1
0
mirror of https://github.com/jtgans/g13gui.git synced 2025-07-08 00:47:25 -04:00
g13gui/g13gui/bitwidgets/display.py
June Tate-Gans ff25e01694 Migrate g13gui out of the g13gui subdir
The whole project at this point is entirely python, with no g13d present
anywhere, so let's clean up the tree somewhat and make it flatter.
2021-05-08 19:47:35 -05:00

26 lines
595 B
Python

import PIL.ImageDraw
import PIL.PyAccess
from PIL import Image
from g13gui.observer.subject import Subject
class Display(Subject):
def __init__(self, displayDevice):
self._displayDevice = displayDevice
self.clear()
def clear(self):
size = self._displayDevice.dimensions
self._bitmap = Image.new(mode='1', size=size)
self._context = PIL.ImageDraw.Draw(self._bitmap)
def getContext(self):
return self._context
def commit(self):
self._displayDevice.update(self._bitmap)
def debug(self):
self._bitmap.show()