Learn IGNITION-PERSPECTIVE with Real Code Examples
Updated Nov 27, 2025
Code Sample Descriptions
1
Hello World Button Script
system.gui.messageBox("Hello World from Ignition Perspective!")
A simple Python script bound to a button's onClick event in Perspective.
2
Start/Stop Control with Perspective
if self.custom.mode == "Start":
system.tag.writeBlocking(["[default]Motor/Start"], [True])
else:
system.tag.writeBlocking(["[default]Motor/Stop"], [True])
A Perspective button script writing to a PLC tag when clicked.
3
Update Numeric Display
value = system.tag.readBlocking(["[default]Tank/Level"])[0].value
self.getSibling("NumericDisplay").props.text = str(value)
Updates a numeric display component with a tag value in Perspective.
4
Toggle Light Indicator
current = system.tag.readBlocking(["[default]Light/On"])[0].value
system.tag.writeBlocking(["[default]Light/On"], [not current])
Toggle a boolean tag controlling a light indicator from a button click.
5
Slider Control for Motor Speed
speed = self.props.value
system.tag.writeBlocking(["[default]Motor/Speed"], [speed])
Bind a slider in Perspective to a motor speed tag.
6
Log Button Clicks
from datetime import datetime
log = system.tag.readBlocking(["[default]ButtonLog"])[0].value
log += f"Clicked at {datetime.now()}\n"
system.tag.writeBlocking(["[default]ButtonLog"], [log])
Append a log entry every time a button is clicked in Perspective.
7
Dynamic Label Update
status = system.tag.readBlocking(["[default]Machine/Status"])[0].value
self.getSibling("StatusLabel").props.text = f"Status: {status}"
Change a label text dynamically based on a tag value.
8
Set Multiple Tags
tags = ["[default]Motor/Start", "[default]Motor/Speed"]
values = [True, 50]
system.tag.writeBlocking(tags, values)
Write multiple tag values simultaneously from a script.
9
Alarm Acknowledge Button
alarmPath = '[default]Tank/HighLevel'
system.alarm.acknowledge(alarmPath)
Acknowledges an alarm in Perspective when a button is clicked.
10
Fetch and Display PLC Data
tags = ["[default]Tank/Level", "[default]Pump/Status"]
values = [v.value for v in system.tag.readBlocking(tags)]
self.getSibling("Table").props.data = [{'Tag': t, 'Value': v} for t, v in zip(tags, values)]
Read multiple PLC tags and display values in a Perspective table.