Forum Archive

Custom Image for a Imageview?

RocketBlaster05

Can anybody tell me how to put a custom picture in an image view? Here is what I have:

#in a class already under self
self.mm = ui.load_view('MainMenu')
img = ui.Image.named('companylogo.PNG')
self.mm['imageview1'].image = img
self.mm.present('fullscreen', hide_title_bar=True)
#all of the presenting goes to the plan but the image doesn't appear and no errors pop up
satsuki.kojima

@RocketBlaster05:
instead of,
img = ui.Image.named('companylogo.PNG')
try :
img = ui.Image('companylogo.PNG')

I think that would work.

cvp

@RocketBlaster05 sure that the image is in the same folder? Try with

img = ui.Image.named('iob:map_32')
RocketBlaster05

@satsuki.kojima Itโ€™s now telling me that it canโ€™t load the image... is the image too large or am I missing something? @cvp

RocketBlaster05

Ah ok fixed the problem. File was saved as .png but it needed to be .PNG

cvp

@RocketBlaster05 ๐Ÿ‘ (thus the image was not in your folder ๐Ÿ˜‚)