Hi there.
I would like to create a script into Script Library to change the color of a button. If I do this from component scripting (button properties), the code would be:
event.source.parent.getComponent(‘Button’).buttonBG = 251,250,249
How the codee would be from Scripting Library?.
Thanks in advance.
If you want to do something like “programmatically alter all buttons the same way”, then I would suggest making a project library function that expects a particular component as the input. E.G:
Project Library Script - utils
def setColors(button):
button.background = system.gui.color(251, 250, 249)
Component Event Script
utils.setColors(event.source.parent.getComponent('Button'))
The crucial part is that you pass the component itself as a reference into your project script.
2 Likes