Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Fri Oct 23 21:01:39 2020
- @author: evenjc
- """
- from PIL import Image
- from time import sleep
- from sense_hat import SenseHat
- senseHat = SenseHat()
- im = Image.open("toons.jpg")
- pix = im.load()
- block_size = 8
- blocks_per_line = im.size[0]/block_size
- xcursor = 0
- ycursor = 0
- #sleep(5)
- while True:
- for ypixel in range(0, block_size):
- for xpixel in range(0, block_size):
- senseHat.set_pixel(xpixel, ypixel, pix[xpixel + (xcursor*block_size), ypixel + (ycursor*block_size)])
- sleep(2)
- if xcursor < 9:
- xcursor = xcursor + 1
- else:
- xcursor = 0
- ycursor = ycursor + 1
- if ycursor > 9:
- ycursor = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement