DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

Performance issue with _help function

Open benjaminthedonkey opened this issue 10 months ago • 2 comments

  1. PLEASE CAREFULLY READ: FAQ

  2. PLEASE CAREFULLY READ: Documentation

  3. FOR FIRST-TIME USERS ISSUES, please use the Discord server.

  4. REMOVE ALL 3RD PARTY LIBRARIES.

  5. PLEASE MAKE SURE that you have: read the FAQ; explored the examples; searched among Issues; and read the link provided in (1) (2).

  6. Be mindful that messages are being sent to the e-mail box of "Watching" users. Try to proof-read your messages before sending them. Edits are not seen by those users.

  7. Delete points 1-7 and PLEASE FILL THE TEMPLATE BELOW before submitting your issue or we will immediately close it.

Thank you!


Version of Dear PyGui

Version: 2.0.0 Operating System: Windows 11

My Issue/Question

The function "_help" that's part of the demo code, makes the application unresponsive.

To Reproduce

Run the code below

Expected behavior

Application should not drag.

Standalone, minimal, complete and verifiable example

# Here's some code anyone can copy and paste to reproduce your issue, if you comment the calls to _help function the application works as expected. 

import dearpygui.dearpygui as dpg

def _help(message):
    last_item = dpg.last_item()
    group = dpg.add_group(horizontal=True)
    dpg.move_item(last_item, parent=group)
    dpg.capture_next_item(lambda s: dpg.move_item(s, parent=group))
    t = dpg.add_text("(?)", color=[0, 255, 0])
    with dpg.tooltip(t):
        dpg.add_text(message)

def show_callback1():
    with dpg.window(label="Example Window1"):
        dpg.add_text("Hello world")
        with dpg.table(header_row=False, policy=dpg.mvTable_SizingFixedFit, delay_search=True,
                                    borders_innerH=True, borders_outerH=True, borders_innerV=True,
                                    borders_outerV=True, row_background=True):

            dpg.add_table_column()
            dpg.add_table_column()
            dpg.add_table_column()

            for i in range(500):
                with dpg.table_row():
                    dpg.add_text("Oh dear")
                    _help('Oh dear help')
                    dpg.add_text("Oh dear")
                    _help('Oh dear help')
                    dpg.add_text("Oh dear")
                    _help('Oh dear help')

def show_callback2():
    with dpg.window(label="Example Window2"):
        dpg.add_text("Hello world")
        with dpg.table(header_row=False, policy=dpg.mvTable_SizingFixedFit, delay_search=True,
                                    borders_innerH=True, borders_outerH=True, borders_innerV=True,
                                    borders_outerV=True, row_background=True):

            dpg.add_table_column()
            dpg.add_table_column()
            dpg.add_table_column()

            for i in range(500):
                with dpg.table_row():
                    dpg.add_text("Oh dear")
                    _help('Oh dear help')
                    dpg.add_text("Oh dear")
                    _help('Oh dear help')
                    dpg.add_text("Oh dear")
                    _help('Oh dear help')


dpg.create_context()
dpg.create_viewport()
dpg.setup_dearpygui()

with dpg.window(label="Example Window"):
    dpg.add_text("Hello world")
    dpg.add_button(label="Show window 1", callback=show_callback1)
    dpg.add_button(label="Show window 2", callback=show_callback2)
    
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

benjaminthedonkey avatar Feb 28 '25 21:02 benjaminthedonkey

I bet it's due to move_item - see #2343 (the fix for it will be shipped in the next release).

v-ein avatar Feb 28 '25 22:02 v-ein

Awesome, thank you.... it makes sense because I stumble into this with only a handful of widgets but a deeper tree. Looking forward to the fix.

benjaminthedonkey avatar Mar 01 '25 01:03 benjaminthedonkey