Displaying an image from album in photos onto screen in scene module
How do I do this?
I made an album with the photos library, now I want to pull a photo from that album and display it in the corner of my screen when I tap on a button.
I have tried everything, I can't use:
self.photoRect = rect(25,25,50,50) self.layer = Layer(self.photoRect)
how do I make this image display in this tiny section after a tap and then tap to get rid of it?
cvp last edited by
@vignesh One more time, I'm not sure that I have correctly understood the question, due to my poor English. Try this and tell me...
The pick photo code is only to have a photo to display.
# coding: utf-8 from scene import * import ui import photos class MyScene (Scene): global ui_image def setup(self): self.background_color = 'ligtgray' img = ui.Button(name='image') img.frame = (25,25,50,50) img.background_image = ui_image img.enable = False img.hidden = True self.view.add_subview(img) b = ui.Button() b.frame = (100,0,60,32) b.title = 'tap' b.action = self.disp_photo self.view.add_subview(b) def disp_photo(self,sender): img = sender.superview['image'] img.hidden = not img.hidden if __name__ == '__main__': global ui_image # pick one photo all_assets = photos.get_assets() asset = photos.pick_asset(assets=all_assets) ui_image = asset.get_ui_image() run(MyScene()) ```
@cvp thank you! I will try to make this work with what I'm working on and I'll let you know if I need more help.
it worked thank you!