• Here is a simple animation based on @JonB 's code. It uses latest update function (available in beta) instead of threads.

    import ui import numpy as np import io from PIL import Image class Screen(ui.View): def __init__(self,w,h): self.width=w self.height=h self.S = np.zeros((w,h), dtype=np.uint8) self.offset = 0 self.S[self.offset:self.offset+20,:] = 255 img = Image.fromarray(self.S, 'L') self.B=io.BytesIO() img.save(self.B, format='PNG') self.update_interval = 1 def set_data(self): self.S[self.offset:(self.offset+20),:] = 0 self.offset = (self.offset+20)%self.width self.S[self.offset:self.offset+20,:] = 255 img = Image.fromarray(self.S, 'L') img.save(self.B, format='PNG') self.B.seek(0) def update(self): self.set_data() self.set_needs_display() def draw(self): ui.Image.from_data(self.B.getvalue()).draw() if __name__=='__main__': import time w=300 h=w s=Screen(w,h) s.present('sheet')
  • @Webmaster4o , ok, great. Thanks that works. You still get the traceback error. But you still need to know to look at the console to see all the error text. But I can modify the error text to say more information in the console, just put it at the top to make sure they see that part of the msg. But of course the more information you can return as an error the better I think

Internal error.

Oops! Looks like something went wrong!