Scripting Error on Compoent "Background" access:

Dear Brother,
when I try
if pfin > 90:
system.gui.getWindow(“LS_CALC”).rootContainer.getComponent(‘NEW_MOTOR_RPM_STD%d’ %cn).background = (223,222,222,222)
I am receiving this error,

The following is the error message
[color=#008080][size=85]
Traceback (innermost last):
File “”, line 95, in ?
TypeError: readonly class or attribute: background

at org.python.core.Py.TypeError(Py.java)
at org.python.core.PyObject.__setattr__(PyObject.java)
at org.python.pycode._pyx18.f$0(<script playground>:95)
at org.python.pycode._pyx18.call_function(<script playground>)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyCode.call(PyCode.java)
at org.python.core.Py.runCode(Py.java)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:394)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:387)
at com.inductiveautomation.ignition.designer.gui.tools.ScriptPlayground.runScript(ScriptPlayground.java:208)
at com.inductiveautomation.ignition.designer.gui.tools.ScriptPlayground$2.actionPerformed(ScriptPlayground.java:222)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)[/size]

Ignition v7.2.8 (b178)
Java: Sun Microsystems Inc. 1.6.0_26
[/color]

can you please help me…
abdul

What kind of component is NEW_MOTOR_RPM_STD#?

Its a Numeric Label

I would print the following to the console to make sure the component really exists:print 'NEW_MOTOR_RPM_STD%d' %cnMy guess is the name is incorrect.

yes the name is absolutelty perfect

actually we upgraded recently to v7.3.1 32 bit
and since then we are facing these issues

even the pages with good designs and colors are now turning to gray scale,
during runtime and the actual configuration done is also affected.
even the fonts and font size and colors are being changed automatically ( to Dailog, plan, 12)
please check teh below images for your reference

abdul




Robin - as another approach, it may be easier to bind the background property to an expression that sets the color based on that pfin value instead of using scripting.

hi nathan, Yeah but can you please look at those two images that i posted down,
if I copy any component and paste them,
I am loosing the original formatting of those components (background, foregroung, font and brorder)
on all pages after upgrading to V7.3 can you please help,
We are covered under total care contract…

awaiting,

Abdul

Can you export that window from the pre-7.3 version that you were using and send it to us or post it here please?

Dear nathan,
withv7.3 running on xp and clients accessing it on Windows 7, and when we launch the designer on
windows 7 we are facing these issues.

please can u reproduce the same
???

Please try what Carl said and export the window on the older version designer.

I am new to the board, but in a spirit of ‘better late than never’, here is the solution to the issue. The syntax was wrong as there is no ‘rootContainer’ method, there is getRootContainer().

Wrong Syntax-
system.gui.getWindow(“LS_CALC”).rootContainer.getComponent(‘NEW_MOTOR_RPM_STD%d’ %cn).background = (223,222,222,222)

Correct-
system.gui.getWindow(“LS_CALC”).getRootContainer().getComponent(‘NEW_MOTOR_RPM_STD%d’ %cn).background = (223,222,222,222)

TQ Very Much