i am working on OLED 2.42" SSD1306 (Adafruit) display. i have successfully made connection according to this link https://satoshinm.github.io/blog/171110 ... _zero.html
i have also been able to write text on OLED successfully with this code
Code: Select all
import time import os.path from demo_opts import get_device from luma.core.virtual import viewport from luma.core.render import canvas from PIL import Image, ImageDraw, ImageFont import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) button=17 GPIO.setup(button,GPIO.IN,pull_up_down=GPIO.PUD_UP) def main(): virtual = viewport(device, width=device.width, height=768) background = Image.new("RGB", device.size, "white") draw = ImageDraw.Draw(background) for _ in range(2): with canvas(virtual) as draw: font=ImageFont.truetype('/home/pi/luma.examples/examples/fonts/ApplyBeefShadow.ttf', 10) draw.text((40, 0), "WELCOME", font=font, fill="white") draw.text((20, 12), 'Its Wine Mill', fill="white") draw.text((20, 24), "have a nice wine", fill="white") time.sleep(60) if __name__ == "__main__": try: device = get_device() main() except KeyboardInterrupt: pass
now i want to highlight this text i mean background should be white and text should be black.
looking for answers