hoffstadt / hoffstadt/DearPyGui

Doc example generates "Alias already exists" exception

Open
#2,263 7 comments 0 reactions 0 assignees View on GitHub
state: pending type: bug
Dominant language
C++
Stars
15.6k
Forks
783
PR merge metrics
No merged PRs in 30d

Description

## Version of Dear PyGui

Version: 1.10.1
Operating System: Windows 11

## My Issue/Question

The first code example under [Runtime Adding and Deleting](https://dearpygui.readthedocs.io/en/latest/documentation/item-creation.html#runtime-adding-and-deleting) in the documentation generates an "Alias already exists" exception when `Add Buttons` is clicked twice in a row without clicking `Delete Buttons`

## To Reproduce

Copy the first code example from the [Runtime Adding and Deleting](https://dearpygui.readthedocs.io/en/latest/documentation/item-creation.html#runtime-adding-and-deleting) and click `Add Buttons` twice.

## Expected behavior

The example code does no generate a runtime exception.
or
The documentation describes why an exception may be generated for the example code.

## Screenshots/Video

![too-many-buttons](https://github.com/hoffstadt/DearPyGui/assets/11022442/46b4c2b8-8f82-4a9e-8a21-bbcf93da2e57)

## Standalone, minimal, complete and verifiable example

```python
import dearpygui.dearpygui as dpg

dpg.create_context()

def add_buttons():
global new_button1, new_button2
new_button1 = dpg.add_button(label="New Button", before="delete_button", tag="new_button1")
new_button2 = dpg.add_button(label="New Button 2", parent="secondary_window", tag="new_button2")

def delete_buttons():
dpg.delete_item("new_button1")
dpg.delete_item("new_button2")

with dpg.window(label="Tutorial", pos=(200, 200)):
dpg.add_button(label="Add Buttons", callback=add_buttons)
dpg.add_button(label="Delete Buttons", callback=delete_buttons, tag="delete_button")

with dpg.window(label="Secondary Window", tag="secondary_window", pos=(100, 100)):
pass

dpg.create_viewport(title='Custom Title', width=600, height=400)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.