36 lines
918 B
Python
36 lines
918 B
Python
# pyright: reportGeneralTypeIssues=false
|
|
|
|
import dearpygui.dearpygui as dpg
|
|
|
|
import dpg_gauges as dpgg
|
|
|
|
|
|
def main() -> None:
|
|
dpg.create_context()
|
|
try:
|
|
states = {
|
|
"ok": dpgg.StatusState((0, 220, 120, 255), "OK"),
|
|
"warn": dpgg.StatusState((255, 190, 0, 255), "WARN"),
|
|
"fault": dpgg.StatusState((255, 45, 45, 255), "FAULT"),
|
|
}
|
|
with dpg.window(label="Status Light", width=300, height=160):
|
|
dpgg.status_light(
|
|
tag="ecu",
|
|
label="ECU",
|
|
state="ok",
|
|
states=states,
|
|
width=240,
|
|
height=80,
|
|
)
|
|
|
|
dpg.create_viewport(title="dpg-gauges status", width=340, height=200)
|
|
dpg.setup_dearpygui()
|
|
dpg.show_viewport()
|
|
dpg.start_dearpygui()
|
|
finally:
|
|
dpg.destroy_context()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|