Problems with ui.imageview
I have some trouble with ui.imageview. Trying to set an image I cannot display images from 'My Images'. Choosing an image from Emojis or Test Images works fine.
view['imageview1'].image = ui.Image.named('_Mauzi')
The "My Images" feature is mostly intended for use with the
scenemodule, and to be honest, I haven't really touched it since version 1.0 – I'd really like to replace it with something better...
Anyway, you can use it with the
uimodule like this:
view['imageview1'].image = ui.Image.named('Images/_Mauzi.png')
This only works if your script is in the root folder of the script library. If that's not the case, try something like this:
import os images_root = os.path.expanduser('~/Documents/Images') image_name = '_Mauzi' image_path = os.path.join(images_root, image_name + '.png') view['imageview1'].image = ui.Image.named(image_path))
Many thanks, now it works fine.