Forum Archive

[solved] built in icon to button?

jmv38

i cant find how to use built in icons into ui buttons. Can anyone give me a link? (must be obvious, sorry).
Thanks

AtomBombed

All you need is a ui.Image for the icons.

# Say we have a button named "mybutton".

import ui

mybutton = ui.Button()
mybutton.image = ui.Image("iob:document_32")
mybutton.present()
jmv38

thanks @AtomBombed
i want to use arrow-resize icon from editor menu but this raise an error

mybutton.image = ui.Image("iob:arrow-resize")
mybutton.image = ui.Image("arrow-resize")

what is wrong?
And how do i get the list of built-in images?

omz

The icons for editor actions are not all available to use in scripts (for licensing reasons). You can get a list of available built-in images using the [+] button in the editor toolbar.

jmv38

thank you @omz
so the answer to my question is (in case anyone needs it)

mybutton.image = ui.Image("iob:arrow_resize_24")

the [+] is quite tricky, it would be useful that when sby type 'icon' in the search filed of documentation, this information pops up (nothing pops up actually when i type 'icon').
Thanks!