Skip to content

Rendering issues for "dpg.collapsing_header" under horizontal grouping #2653

@nehonpa

Description

@nehonpa

Dear PyGui version:

2.3

Python version:

3.8.5

Operating system:

windows 11

My issue/question:

I'm not sure if this counts as a bug, but it doesn't seem to have achieved the expected results. I placed a sub-window and a fold control in the horizontal layout group, but the display effect turned into a vertical placement. I initially thought the issue was with version 2.3, but my attempt at using 2.0 yielded the same result.

Steps to reproduce:

  1. run code
  2. Click "collapsing_header"
  3. An unexpected state of seeing their effects appear

Expected behavior:

Normally, it should be divided into left and right layouts, rather than rendering controls from folded items below the list box.

Screenshots:

Image

Standalone, minimal, complete and verifiable example:

import dearpygui.dearpygui as dpg
import time
dpg.create_context()
with dpg.window(label='字体管理', tag='主窗口', width=897, height=680, pos=[650, 400], no_resize=True):
    with dpg.group(tag='分组容器_(1)', pos=[32, 50]):
        dpg.add_text(default_value='已添加的列表:', tag='纯文本')

        with dpg.group(horizontal=True, horizontal_spacing=50.0):
            dpg.add_listbox(tag='列表框', width=391, num_items=8)

            with dpg.collapsing_header(label='collapsing_header', tag='new_折叠项目'):
                with dpg.child_window(tag='child_window', width=400, height=259):
                    dpg.add_combo(items=[],label='字体', tag='下拉框', width=356)

                    dpg.add_text(default_value='不支持的字体文件', tag='纯文本_(1)')

                    dpg.add_spacer(tag='copy_占位用的空间(1)', height=3)

                    with dpg.group(tag='分组容器_(4)', horizontal=True, horizontal_spacing=50.0):
                        dpg.add_slider_int(label='size', tag='整数滑块', width=172,default_value=20, min_value=4, max_value=100)

                    dpg.add_spacer(tag='占位用的空间_(2)', height=28)

                    with dpg.group(tag='copy_分组容器(1)', horizontal=True, horizontal_spacing=50.0):
                        dpg.add_button(label='添加列表', tag='添加列表', width=160, height=40)

                        dpg.add_button(label='删除', tag='删除', width=160, height=39)

                    dpg.add_spacer(tag='占位用的空间_(3)', height=6)

                    with dpg.group(tag='copy_分组容器(2)', horizontal=True, horizontal_spacing=50.0):
                        dpg.add_button(label='应用字体', tag='copy_普通按钮(1)', width=160, height=40)

                        dpg.add_button(label='重置字体', tag='copy_普通按钮(2)', width=160, height=39)

        dpg.add_spacer(tag='占位用的空间', height=22)

        dpg.add_separator(tag='水平分界线')

        dpg.add_spacer(tag='占位用的空间_(1)', height=24)

        with dpg.group(tag='分组容器_(2)', horizontal=True, horizontal_spacing=50.0):
            dpg.add_input_text(label='text', tag='text', hint='请输入文本测试')

            dpg.add_button(label='提交', tag='提交', width=166)

        with dpg.child_window(tag='子窗口', width=836, height=251):
            pass

dpg.create_viewport(title='main_UI', width=923, height=735,vsync=False)
dpg.setup_dearpygui()

dpg.show_viewport()
while dpg.is_dearpygui_running():
    interval = 1 / 600
    time.sleep(interval)
    dpg.render_dearpygui_frame()

dpg.destroy_context()

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions