Skip to content

Instantly share code, notes, and snippets.

@dubcl
Created April 24, 2018 03:29
Show Gist options
  • Save dubcl/34916fdee6553646e9266749186551bc to your computer and use it in GitHub Desktop.
Save dubcl/34916fdee6553646e9266749186551bc to your computer and use it in GitHub Desktop.
text demo for ssd1306
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014-17 Richard Hull and contributors
# See LICENSE.rst for details.
# PYTHON_ARGCOMPLETE_OK
"""
Use misc draw commands to create a simple image.
Ported from:
https://github.com/adafruit/Adafruit_Python_SSD1306/blob/master/examples/shapes.py
"""
import time
import datetime
from demo_opts import get_device
from luma.core.render import canvas
def primitives(device, draw):
draw.text((device.width - 100, 25), 'Hello World!', fill="cyan")
def main():
device = get_device()
for _ in range(2):
with canvas(device) as draw:
primitives(device, draw)
time.sleep(30)
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment