Forum Archive

Imageview not updating to image from picker

robertiii

I cannot get the imageview to update. Not sure exactly how to use this, but here’s the code.

image = photos.pick_asset(multi=False)

img = image.get_ui_image()

imageView = ui.ImageView('image')

imageView.image = img
omz

It looks like the image is set correctly, but you're never actually showing the image view. Add something like imageView.present() at the end.

robertiii

I did present. And it caused the image to show in the console or something not in the view

omz

@robertiii Are you sure that you used imageView.present() and not img.show()?

robertiii

Yes. It only shows a pop-up with the photo

omz

Okay, and what did you expect?

robertiii

How do I select an imageView in a pyui. That may be the problem

omz

Can you be a bit more specific? I'm not sure what exactly you're talking about.

robertiii

I have an imageView on the pyui. Whenever I say present it presents in full screen not to the imageView. How do i set the imageView to display the image rather than showing the sheet or full screen.

omz

Okay, so you have a .pyui file that you load via ui.load_view, right? load_view returns the "main" view that was loaded. The image view you created in the UI editor has a "name" (by default something like 'imageview1') that you can set in the inspector panel.

You can access subviews of the "main" view using subscript notation, like this:

# ...
# img = ...
v = ui.load_view('myui.pyui')
img_view = v['imageview1']
img_view.image = img
robertiii

I figured it out though I’m not exactly sure what I did differently! Thanks! Next question....any way of playing video?