step 3: add widget shell and renderer foundation
This commit is contained in:
35
examples/dashboard.py
Normal file
35
examples/dashboard.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:
|
||||
with (
|
||||
dpg.window(label="Dashboard", width=620, height=360),
|
||||
dpgg.gauge_panel(label="Engine", width=580, height=260),
|
||||
dpgg.gauge_grid(columns=3),
|
||||
):
|
||||
dpgg.analog_gauge(
|
||||
tag="rpm", label="RPM", value=4200, max_value=8000, width=180, height=180
|
||||
)
|
||||
dpgg.digital_gauge(
|
||||
tag="speed", label="Speed", value=88, unit="km/h", width=160, height=90
|
||||
)
|
||||
dpgg.digital_gauge(
|
||||
tag="temp", label="Coolant", value=91, unit="C", width=160, height=90
|
||||
)
|
||||
|
||||
dpg.create_viewport(title="dpg-gauges dashboard", width=660, height=400)
|
||||
dpg.setup_dearpygui()
|
||||
dpg.show_viewport()
|
||||
dpg.start_dearpygui()
|
||||
finally:
|
||||
dpg.destroy_context()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user