Clarify grid autobreak behavior

This commit is contained in:
2026-07-07 23:06:53 +01:00
parent 44403bea2b
commit 5bd819d812
5 changed files with 52 additions and 17 deletions

View File

@@ -9,7 +9,7 @@ def main() -> None:
dpg.create_context()
try:
with dpg.window(label="Grid layout", width=820, height=620):
dpg.add_text("Three-column grid: fixed column cap, automatic rows")
dpg.add_text("Max columns: columns=3 wraps onto new rows after every third gauge")
with dpgg.gauge_panel(label="Wide panel", width=-1, height=270), dpgg.gauge_grid(
columns=3, min_column_width=190
):
@@ -26,9 +26,10 @@ def main() -> None:
dpgg.battery_gauge(tag="grid_battery", label="Battery", value=74, height=160)
dpg.add_spacer(height=8)
dpg.add_text("Narrow panel: columns=3 auto-reduces to avoid horizontal scrolling")
with dpgg.gauge_panel(label="Narrow panel", width=390, height=250), dpgg.gauge_grid(
columns=3, min_column_width=180
dpg.add_text("Autobreak: columns='auto' chooses columns from available width")
with (
dpgg.gauge_panel(label="Autobreak narrow panel", width=430, height=285),
dpgg.gauge_grid(columns="auto", min_column_width=180),
):
for index, value in enumerate((18, 42, 67, 91, 55), start=1):
dpgg.digital_gauge(