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.
Set Button image programmatically
-
This could be a dumb question. But I had no success on setting a button's image programmatically, i.e. NOT using UI designer.
I tried following code
b = ui.Button(image=ui.Image(os.path.expanduser('~/Pythonista.app/Textures/ionicons-close-circled-24.png')))
and
b = ui.Button() b.image = ui.Image(os.path.expanduser('~/Pythonista.app/Textures/ionicons-close-circled-24.png'))
None of above codes works.
Any advices?
-
Try:
b.image = ui.Image.named('ionicons-close-circled-24.png')
See: http://omz-forums.appspot.com/pythonista/post/6449019224064000
-
Thanks!
Just realised it is in fact documented ...