hoffstadt / hoffstadt/DearPyGui

Windows containing a collapsing_header inside a group expand over time when autosize=True

Open
#2,500 3 comments 0 reactions 0 assignees View on GitHub
state: pending type: bug
Dominant language
C++
Stars
15.6k
Forks
783
PR merge metrics
No merged PRs in 30d

Description

Version: 2.0.0
Operating System: Ubuntu 22.04

## My Issue/Question

When creating a window with the following properties:
- *autosize = True*
- containing a group
- and a *collapsing_header* inside that group

the collapsing header and thus the window will expand over time *if* the collapsing_header does not show any items (either because it's empty or doesn't have any). See the code below. Opening the *collapsing_header* to show its items resets the window size, assuming it has any items.

Curiously, this does **not** happen if the collapsing_header is not inside a group. However, setting a size on a containing group does not prevent this.

![Image](https://github.com/user-attachments/assets/11224f16-cfee-469a-8bed-8d2aa8879980)

## Expected Behavior

I would have expected that the *collapsing_header* either fills its container or keeps to the size of its children.

## Minimal standalone example

```python
"""The dearpygui demo, used for reference."""

import dearpygui.dearpygui as dpg
import dearpygui.demo as demo

dpg.create_context()
dpg.create_viewport(title="Custom Title", width=600, height=600)

#demo.show_demo()
with dpg.window(autosize=True):
with dpg.group():
dpg.add_collapsing_header(label="Empty")

with dpg.window(autosize=True):
with dpg.group():
with dpg.collapsing_header(label="With items"):
dpg.add_text("Item 1")
dpg.add_text("Item 2")
dpg.add_text("Item 3")

with dpg.window(autosize=True):
dpg.add_collapsing_header(label="Empty without group")

dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.