def draw(self, image, position, offset): """ Draw the label on (x,y) position of an image with starting at <offset> """ width, height = image.size if self.textwidth > width: i = offset % (self.textwidth + int(0.1 * width)) else: i = 0 position = (int((width - self.textwidth) / 2), position[1]) temp = self._image.crop((i, 0, width + i, self.textheight)) wiringpi.piLock(0) image.paste(temp, position) wiringpi.piUnlock(0)
def display(self, image): """ Update display with new image """ wiringpi.piLock(0) self._display.image(image) self._display.display() wiringpi.piUnlock(0)