def show_text(self, txt, speed=20, font=None): """ Display text & scroll, call is blocking """ if (type(txt) is not list) or (len(txt)==0) or (type(txt[0]) is not tuple): raise Exception("a list of tuple is expected") im = draw_multiple_to_image(txt, font) slices = horizontal_slices(im) for i, s in enumerate(slices): #s.save("./debug/%s.bmp"%i) self.set_static_image(build_img(s)) time.sleep(1.0/speed)
def show_text2(self, txt, font=None): """ Use dynamic_image_message to display scolling text Cannot go faster than 1fps """ if (type(txt) is not list) or (len(txt)==0) or (type(txt[0]) is not tuple): raise Exception("a list of tuple is expected") imgs = [] im = divoom_image.draw_multiple_to_image(txt, font) slices = horizontal_slices(im) for i, s in enumerate(slices): # s.save("./debug/%s.bmp"%i) imgs.append(build_img(s)) print len(imgs) self.set_dynamic_images(imgs)