38 lines
1023 B
Python
38 lines
1023 B
Python
# pyright: reportGeneralTypeIssues=false
|
|
|
|
import dearpygui.dearpygui as dpg
|
|
|
|
import dpg_gauges as dpgg
|
|
|
|
|
|
def main() -> None:
|
|
dpg.create_context()
|
|
try:
|
|
thresholds = [
|
|
dpgg.ThresholdBand(0, 30, (60, 180, 90, 150), "normal"),
|
|
dpgg.ThresholdBand(70, 100, (255, 80, 45, 150), "hot"),
|
|
]
|
|
markers = [dpgg.GaugeMarker(85, (255, 255, 255, 255), "limit", 3)]
|
|
with dpg.window(label="Thresholds and Markers", width=420, height=220):
|
|
dpgg.bar_gauge(
|
|
tag="coolant",
|
|
label="Coolant",
|
|
value=76,
|
|
unit="C",
|
|
width=340,
|
|
height=100,
|
|
thresholds=thresholds,
|
|
markers=markers,
|
|
)
|
|
|
|
dpg.create_viewport(title="dpg-gauges thresholds", width=460, height=260)
|
|
dpg.setup_dearpygui()
|
|
dpg.show_viewport()
|
|
dpg.start_dearpygui()
|
|
finally:
|
|
dpg.destroy_context()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|