Bundle Support for Multiple Icons

Hello :wave:

Is there a way to switch out a bundle’s icon? Simplest example being the bundle defaults to off/false/no, then clicked once by the user puts it into the on/true/yes state, clicked again brings it back to off/false/no; like a lightbulb turning on or off.

Thanks!

pyRevit has .smartbutton bundles that it uses for its toggle buttons:

At startup the __selfinit__ is called to set the icon and state of the tool:

__selfinit__

Then when clicked, the tool can toggle its icon. It works with the assumption that there are on.png and off.png icons in the bundle:

script.toggle_icon()

See this example bundle

2 Likes

Awesome! :star_struck: Thank you!

1 Like