Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Image.from_data() not a method?
-
I am trying to load an image from the camera roll as the background of a button.
<pre>
from PIL import Image
import ui
import photoswindow = ui.load_view()
window.present('sheet')window['button'].background_image = Image.from_data(photos.get_image(-1,True,True))
</pre>What am I doing wrong? It says that
from_data
is not a method -
Try
ui.Image.from_data()
instead.Image
alone refers to PIL in your script. -
Thanks once again Ole, haha. Don't worry, I am actually using this information for a useful purpose.
I have been wanting to use local images in the Imageview control for the longest (not an option in the Custom UI action) so I finally dug into the modules a bit.
Now I can load these images in:
<pre>
from PIL import Image
import ui
import photoswindow = ui.load_view()
window.present('sheet')image = ui.Image.from_data(photos.pick_image(True,False,True,True,False))
window['view'].image = image
</pre>
Now to animate...