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.
photos.pick_image() Help
-
How come the photos.pick_image() call doesn't work inside a function but works outside?
def pick_photo(sender): pic = photos.pick_image()
-
It does work in a function, but not within a ui action. The reason for this is that ui actions block the main thread of the app by default, which would essentially cause it to hang if it would present a modal dialog or anything like that. The
pick_image
function detects this, and simply does nothing in this case.You can fix this by "decorating" your action with
@ui.in_background
, like this:@ui.in_background def pick_photo(sender): pic = photos.pick_image()