step 4: add digital bar level and status gauges
This commit is contained in:
35
examples/basic_status.py
Normal file
35
examples/basic_status.py
Normal file
@@ -0,0 +1,35 @@
|
||||
# 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()
|
||||
Reference in New Issue
Block a user