Forum Archive

Show image.png as ui button background or in image view

GSpaceC

I can’t get the image to show up. I don’t understand the documentation. Could someone post an example pls?

cvp

@GSpaceC quick and dirty

import ui

v = ui.View()
v.frame = (0,0,200,200)
v.background_color = 'white'

b = ui.Button()
b.image = ui.Image.named('test:Peppers').with_rendering_mode(ui.RENDERING_MODE_ORIGINAL)
b.frame = (10,10,100,100)
v.add_subview(b)

im = ui.ImageView()
im.frame = (120,120,70,70)
im.image = ui.Image.named('test:Peppers')
v.add_subview(im)

v.present('sheet')