Example #1
0
def main_graphics():
    from PIL import Image
    import numpy
    from ZO import Image

    print('main_graphics')

    img = Image.ZO_Image()
    pix = zero_one.PixelDriver()

    # Set up the pattern and load an image from disk
    # img.clear_pattern()
    # img.set_pattern(image.ZO_Image.Patterns.OneOutline)
    # img.set_pattern(image.ZO_Image.Patterns.OneInterior, rgb='white')
    # img.set_pattern(image.ZO_Image.Patterns.ZeroOutline, rgb='green')
    # img.set_pattern(image.ZO_Image.Patterns.ZeroInterior, rgb='yellow')
    img.load_from_file(Image.TEST_PATTERN_FILE)

    # img.image.show()
    img.show_pattern = False
    # img.image.show()

    # Exit early

    try:
        while True:
            img.show_pattern = False
            pix.update_display(img.image)
            time.sleep(2)
            # pix.blank_display()
            # time.sleep(2)
    except KeyboardInterrupt:
        pix.clear_display()

        # img.show_pattern = True
        # pix.update_display(img.image)

    return

    # Open the file, get the data and convert it to a list
    imgData = list(Image.open(image.TEST_PATTERN_FILE).getdata())