@guran please, try this one
import ui l = { 'cat':['emj:Angry','emj:Astonished','emj:Cold_Sweat_1','emj:Cold_Sweat_2'], 'face':['emj:Cat_Face','emj:Cat_Face_Crying','emj:Cat_Face_Grinning']} v = ui.View() v.background_color = 'white' iv1 = ui.ImageView(name='cat') iv1.background_color = 'white' iv1.frame = (0,50,v.width,v.height-50) v.add_subview(iv1) iv2 = ui.ImageView(name='face') iv2.background_color = 'white' iv2.frame = (0,50,v.width,v.height-50) v.add_subview(iv2) def b_action(sender): iv = v[sender.name[1:]] iv.image = sender.image iv.content_mode = ui.CONTENT_SCALE_ASPECT_FIT iv.hidden = False iv.bring_to_front() b1 = ui.Button(name='bcat') b1.idx = 0 b1.frame = (10,10,32,32) b1.image = ui.Image.named(l['cat'][b1.idx]). with_rendering_mode(ui.RENDERING_MODE_ORIGINAL) b1.action = b_action v.add_subview(b1) b2 = ui.Button(name='bface') b2.idx = 0 b2.frame = (50,10,32,32) b2.image = ui.Image.named(l['face'][b2.idx]). with_rendering_mode(ui.RENDERING_MODE_ORIGINAL) b2.action = b_action v.add_subview(b2) def b_next_action(sender): nam = sender.title[5:] b = v['b'+nam] b.idx += 1 if b.idx == len(l[nam]): b.idx = 0 b.image = ui.Image.named(l[nam][b.idx]). with_rendering_mode(ui.RENDERING_MODE_ORIGINAL) b_next1 = ui.ButtonItem() b_next1.title = 'next cat' b_next1.action = b_next_action b_next2 = ui.ButtonItem() b_next2.title = 'next face' b_next2.action = b_next_action v.right_button_items = (b_next2,b_next1) v.present()Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.