Hi, I want to create a button that launches the camera (...and saves the photo in the next step). Somehow whenever I press the button with photos.capture_image()
in the script below, Pythonsista freezes. I thought that I could get around this with masking it with @ui.in_background
but that doesn't work. Some idea how to trigger the camera from the button? (Note: If I write the photos.capture_image()
outside of the ui.View class it launches the camera)
import ui
import console
import clipboard
import photos
class Extracter(ui.View):
def __init__(self):
# Some UI Elements
(...)
# Take Photo Button
self.take_photo = ui.Button(flex = 'LR', title = 'Take Photo')
self.take_photo.action = self.take_photo_action
# Some Button Styles
(...)
# Take Photo Action
@ui.in_background
def take_photo_action(self, sender):
image = photos.capture_image()
if __name__=='__main__':
view = Extracter()