Replies: 4 comments 1 reply
-
explicate naming of parents during item creation is accepted, it allows for the order of the code and the layout to be decoupled, which can help with maintaining code. move item is useful after the item has been created (typically at run time) when that item needs to change containers or move up or down in their container order. |
Beta Was this translation helpful? Give feedback.
-
ah, I see the parent named is not the same parent of the item named in the Maybe we shouldn't allow both of those to be accepted (its ambiguous) in reality the parent keyword is not needed when assigning the before keyword. The reason this is working currently is due to the order the keywords are being parsed. DPG is essentially moving the item 2 times underneath |
Beta Was this translation helpful? Give feedback.
-
@Pcothren I personally do not use with context. as I am building a custom OOP layer on What bothers me is import dearpygui.dearpygui as dpg
dpg.create_context()
dpg.create_viewport()
dpg.setup_dearpygui()
with dpg.window(label="Dear PyGui Demo", width=800, height=800,
pos=(100, 100), tag="__demo_id") as w1:
with dpg.collapsing_header(label="some label 111", default_open=True,) as p1:
a1 = dpg.add_text(default_value="Some text 111")
with dpg.collapsing_header(label="some label 222", default_open=True,) as p2:
a2 = dpg.add_text(default_value="Some text 222", before=a1)
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context() Another solution if it makes sense is remove
|
Beta Was this translation helpful? Give feedback.
-
Yeah, "before" and "parent" are an either/or situation. If you want to append to a container, use "parent". If you want to insert an item before another item, use "before". When used together, "before" takes priority. |
Beta Was this translation helpful? Give feedback.
-
Version of Dear PyGui
Version: 1.0.2
Operating System: Windows 11
My Issue/Question
Adding
before
widget from differentparent
should not workTo Reproduce
First snippet: Works as expected
Second snippet: Should fail but works
dpg.move_item()
Beta Was this translation helpful? Give feedback.
All reactions