step 3: add widget shell and renderer foundation
This commit is contained in:
25
examples/basic_analog.py
Normal file
25
examples/basic_analog.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# pyright: reportGeneralTypeIssues=false
|
||||
|
||||
import dearpygui.dearpygui as dpg
|
||||
|
||||
import dpg_gauges as dpgg
|
||||
|
||||
|
||||
def main() -> None:
|
||||
dpg.create_context()
|
||||
try:
|
||||
with dpg.window(label="Analog Gauge", width=320, height=320):
|
||||
dpgg.analog_gauge(
|
||||
tag="rpm", label="RPM", value=3250, max_value=8000, width=240, height=240
|
||||
)
|
||||
|
||||
dpg.create_viewport(title="dpg-gauges analog", width=360, height=360)
|
||||
dpg.setup_dearpygui()
|
||||
dpg.show_viewport()
|
||||
dpg.start_dearpygui()
|
||||
finally:
|
||||
dpg.destroy_context()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
25
examples/basic_digital.py
Normal file
25
examples/basic_digital.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# pyright: reportGeneralTypeIssues=false
|
||||
|
||||
import dearpygui.dearpygui as dpg
|
||||
|
||||
import dpg_gauges as dpgg
|
||||
|
||||
|
||||
def main() -> None:
|
||||
dpg.create_context()
|
||||
try:
|
||||
with dpg.window(label="Digital Gauge", width=320, height=180):
|
||||
dpgg.digital_gauge(
|
||||
tag="speed", label="Speed", value=72, unit="km/h", width=260, height=100
|
||||
)
|
||||
|
||||
dpg.create_viewport(title="dpg-gauges digital", width=360, height=220)
|
||||
dpg.setup_dearpygui()
|
||||
dpg.show_viewport()
|
||||
dpg.start_dearpygui()
|
||||
finally:
|
||||
dpg.destroy_context()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
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()
|
||||
25
examples/sizing.py
Normal file
25
examples/sizing.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# pyright: reportGeneralTypeIssues=false
|
||||
|
||||
import dearpygui.dearpygui as dpg
|
||||
|
||||
import dpg_gauges as dpgg
|
||||
|
||||
|
||||
def main() -> None:
|
||||
dpg.create_context()
|
||||
try:
|
||||
with dpg.window(label="Sizing", width=520, height=300):
|
||||
dpgg.digital_gauge(tag="fixed", label="Fixed", value=12.3, width=180, height=80)
|
||||
dpgg.digital_gauge(tag="wide", label="Fill width", value=45.6, width=-1, height=80)
|
||||
dpgg.analog_gauge(tag="square", label="Square", value=60, width=180, height=180)
|
||||
|
||||
dpg.create_viewport(title="dpg-gauges sizing", width=560, height=340)
|
||||
dpg.setup_dearpygui()
|
||||
dpg.show_viewport()
|
||||
dpg.start_dearpygui()
|
||||
finally:
|
||||
dpg.destroy_context()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user