Using photos.pick_image() in a scene
joshwhitehouse last edited by
I am trying to use photos.pick_image in a "Scene with Layers" but replacing in setup(self) the line "self.layer.image = 'Snake' " with "self.layer.image = photos.pick_image()" results in only the background being displayed. Trying to use the PIL Image.open() fails as well. How do I use the picker with the PIL (tried Image.load(photos.pick_image()) with no success) and get this to work with a scene? Thanks...
ccc last edited by
photos.pick_image() must be called before scene.Scene.setup(). However...<br />scene.load_pil_image() must be called in or after scene.Scene.setup().
From Brumm's excellent photo_text.py example, try the syntax:
class PhotoText(scene.Scene): def __init__(self): self.img = photos.pick_image() if self.img: scene.run(self) def setup(self): self.img = scene.load_pil_image(self.img)
See his example for dealing with self.img in your setup() and other scene.Scene methods().