I’m new to Ignition and Python. I’m using version 7.6.3 for x64 windows.
I would like to understand the correct way to use class logic in scripting.
I created module app.logic with this code:
[code]class Angle():
angle = 88
def getAngle():
import system,app
return angle
def inst():
import system,app
instance = app.logic.Angle()
return instance.getAngle()[/code]
I have a button with this ActionPerformed script:
from app.logic import inst
from app.logic import Angle
angle = app.logic.inst()
event.source.parent.getComponent('Label 1').text = str(angle)
When I click the button I get the following error:
[code]Traceback (most recent call last):
File “event:actionPerformed”, line 3, in
File “module:app.logic”, line 12, in inst
TypeError: getAngle() takes no arguments (1 given)
(stack trace removed)
Ignition v7.6.3 (b2013090513)
Java: Sun Microsystems Inc. 1.6.0_43
[/code]
Not sure if I have imports in the right places, but hoping to get 88 to display on my label.
Where have I gone wrong?