mvStyleVar_ItemSpacing shows results that exceed expectations

Open
#2,657 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
cpp, python
Domain
desktop, frontend

Research direction

Start by running the standalone Python example with Dear PyGui 2.3.1 and observe how mvStyleVar_ItemSpacing behaves after the theme is bound to child_window. Trace the theme-binding and child-window behavior around dpg.add_theme_style, then verify that spacing changes affect the child controls without changing the sibling input and buttons at the parent level.

Written by the indexing model from the issue text.

Description

state: pending type: bug
Dear PyGui version:

2.3.1

Python version:

3.10.8

Operating system:

windows 11

My issue/question:

When adjusting the spacing of the sub-window, I found that, in addition to adjusting the styles within the sub-controls, it even pulled apart from the next control at the same level, which seemed unreasonable to me. My expected idea is that it will only apply to subclass controls.

Steps to reproduce:

1.run code
2.see child_window

Expected behavior:

I think it should only apply to subclasses.

Screenshots:
Image
Standalone, minimal, complete and verifiable example:
import time

import dearpygui.dearpygui as dpg

dpg.create_context()

with dpg.theme(tag="theme_子窗口"):
    with dpg.theme_component(dpg.mvAll):
        dpg.add_theme_style(dpg.mvStyleVar_ItemSpacing, 8, 72, category=0)


with dpg.window(tag='窗口', width=793, height=500):
    with dpg.child_window(label='1', tag='子窗口', height=223):
        dpg.add_text(default_value='123', tag='纯文本')

        dpg.add_text(default_value='123', tag='纯文本_(1)')

        dpg.add_text(default_value='123', tag='纯文本_(2)')

        dpg.add_text(default_value='123', tag='纯文本_(3)')

        dpg.add_text(default_value='123', tag='纯文本_(4)')

        dpg.add_text(default_value='123', tag='纯文本_(5)')

        dpg.add_text(default_value='123', tag='纯文本_(6)')

    dpg.bind_item_theme('子窗口', 'theme_子窗口')
    dpg.add_input_text(tag='文本输入框')

    dpg.add_button(tag='copy_普通按钮(1)')

    dpg.add_button(tag='普通按钮')

dpg.create_viewport(title='main_UI', width=819, height=555,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()
Dominant language
C++
Stars
15.7k
Forks
790
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hoffstadt/DearPyGui

All issues in hoffstadt/DearPyGui

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.