Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collapsing_header infinite in width when part of a node #2437

Open
uxy-byte opened this issue Dec 4, 2024 · 0 comments
Open

Collapsing_header infinite in width when part of a node #2437

uxy-byte opened this issue Dec 4, 2024 · 0 comments
Labels
state: pending not addressed yet type: bug bug

Comments

@uxy-byte
Copy link

uxy-byte commented Dec 4, 2024

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()

@uxy-byte uxy-byte added state: pending not addressed yet type: bug bug labels Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: pending not addressed yet type: bug bug
Projects
None yet
Development

No branches or pull requests

1 participant