A touchscreen HMI in plain Tkinter, beacons included
Kiosk mode for an operator panel
Refresh with after(), not threads
after() scheduler: the GUI thread reads the latest measurements every 500 ms and repaints. No background threads touching widgets, no race conditions — the classic Tkinter pitfall avoided by design while the acquisition modules do the slow work.Beacons mirror machine state
A snippet from the implementation
Straight from the example as deployed on the Raspberry PLC 19R — copy it freely:
def set_beacon(active_color):
"""Turn on a single beacon and switch off the rest (exclusive state)."""
for color, relay in BEACONS.items():
state = rpiplc.HIGH if color == active_color else rpiplc.LOW
rpiplc.digital_write(relay, state)The full example is a complete program — wiring header, setup and main loop — ready to adapt to your application.
Frequently asked questions
Why Tkinter instead of a web dashboard?
Zero dependencies and total offline reliability. The bench must work with no network and survive OS reimages; Tkinter is in the standard library, starts in under a second and runs for weeks.
Does the GUI block the test sequence?
No. The sequence logic runs from the same event loop via after() callbacks, and the heavy I/O (SCPI, I2C) completes in milliseconds. For hour-long tests the loop simply reschedules itself.
Can I drive real stack lights directly from the PLC relays?
Yes, that is the point of the Raspberry PLC. The R0.x outputs are dry-contact relays rated for 24 V signal beacons, so the lights wire straight to the terminals without external relay boards.