Changing component properties on another open window

I am trying to set a button property on another open window with the following...

window = system.gui.getWindow('System/BottomMenu')
comp = window.rootContainer.getComponent("SpareButton1")
comp.getComponent("SpareButton1").visible = True

It is giving the following error...

Traceback (most recent call last):
  File "<event:visionWindowOpened>", line 3, in <module>
TypeError: getComponent(): 1st arg can't be coerced to int


Ignition v8.1.21 (b2022092908)
Java: Azul Systems, Inc. 11.0.15

Thanks

This worked, not 100% sure why though...

system.gui.getWindow("System/BottomMenu").rootContainer.getComponent("SpareButton1").visible = True
window = system.gui.getWindow('System/BottomMenu')
comp = window.rootContainer.getComponent("SpareButton1")
comp.visible = True

You were calling the getComponent two times

N.

3 Likes

Thanks! It was late and my eyes were crossing! :laughing: