DearPyGui
DearPyGui copied to clipboard
Collapsing_header infinite in width when part of a node
Version of Dear PyGui
Version: 2.0.0 Operating System: Windows 11 Pro
My Issue/Question
When a collapsing_header is nested inside a node, the collapsing_header becomes infinitely wide.
To Reproduce
Nest a collapsing_header inside a node_attribute
Expected behavior
The collapsing_header should either size itself correctly such that the width is consistent with the node dimensions, or the collapsing_header should allow for the width parameter to be explicitly set during creation. The automatic sizing of the node in the vertical direction works fine as a function of whether the collapsing_header is open or closed.
Standalone, minimal, complete and verifiable example
import dearpygui.dearpygui as dpg
def add_collapsible_node(position=(0, 0)):
"""Add a node with constrained collapsible content."""
with dpg.node(label="Collapsible Node", parent="node_editor", pos=position):
# Main content section (always visible)
with dpg.node_attribute(label="Main Content"):
dpg.add_text("Always visible content")
# Collapsible section with fixed width and height
with dpg.node_attribute(label="Collapsible Content"):
with dpg.collapsing_header(label="Details", default_open=True):
# Contents of the collapsible header
dpg.add_text("Collapsible content")
dpg.add_input_float(label="Input Value", default_value=42.0, width=150)
dpg.add_button(label="A Button", callback=lambda: print("Button Clicked"))
"""Create the main UI."""
dpg.create_context()
dpg.create_viewport(title="Collapsible Node Example", width=800, height=600)
with dpg.window(label="Node Editor", width=800, height=600):
with dpg.node_editor(tag="node_editor"):
add_collapsible_node(position=(100, 100))
add_collapsible_node(position=(300, 200))
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()