def exporti(sender): console.show_activity() ishare['colorbox'].end_editing() color = ishare['colorbox'].text if color != '': if not color.startswith('#'): color = '#'+color if len(color) != 7: raise ValueError('Must be hexidecimal') im = RenderASCII(out, bgcolor=color) i.image = pil_to_ui(im) rootView.background_color = color view2.draw() else: im = outim b = BytesIO() im.save(b, 'PNG') img_data = b.getvalue() console.hide_activity() _dialogs.share_image_data(img_data)
def exporti(sender): console.show_activity() ishare['colorbox'].end_editing() color = ishare['colorbox'].text if color != '': color = getrgb(color) # Get RGB for color im = RenderASCII(out, bgcolor=color) i.image = pil_to_ui(im) rootView.background_color = color view2.draw() else: im = outim b = BytesIO() im.save(b, 'PNG') img_data = b.getvalue() console.hide_activity() _dialogs.share_image_data(img_data)