DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

Nested Draw Layers raise an error

Open axeldavy opened this issue 1 year ago • 1 comments

Version of Dear PyGui

Version: 1.11.1 Operating System: Arch Linux

My Issue/Question

I found out that using draw layers to quickly hide/show or delete lists of items gives a huge performance boost compared to doing it manually on each item.

As such I started making use of them a lot.

However I got an error when trying to create a draw layer inside a draw layer. I do not think there should be such a restriction.

To Reproduce

This code raises the following error:

import dearpygui.dearpygui as dpg

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

with dpg.window(tag="Primary Window"):
    with dpg.plot():
        with dpg.draw_layer():
            with dpg.draw_layer():
                print('Hello')

Exception: 
Error:     [1003]
Command:   add_draw_layer
Item:      24 
Label:     
Item Type: mvAppItemType::mvDrawLayer
Message:   Incompatible parent. Acceptable parents include:     mvAppItemType::mvTemplateRegistry
mvAppItemType::mvStage
mvAppItemType::mvDrawlist
mvAppItemType::mvWindowAppItem
mvAppItemType::mvPlot
mvAppItemType::mvViewportDrawlist

Expected behavior

Being able to use draw layers inside draw layers.

Simply adding draw layers as possible child/parent of draw layers inside the code works in my usecase, but there might be a bit more work in order to handle correctly the optional properties of draw layers.

axeldavy avatar Aug 01 '24 18:08 axeldavy

https://github.com/hoffstadt/DearPyGui/issues/2452 Same problem as mine

dpg.plot Layer not supported

dpg.drawlist dpg.draw_layer dpg.add_drag_rect

I hope to solve the problem But I'm not sure how to solve it

monkeycc avatar Dec 30 '24 08:12 monkeycc