Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

dpg.get_value doesn't return selected item in special case when item in items gets deleted #1640

Closed
christooss opened this issue Mar 6, 2022 · 1 comment
Labels
state: ready Fixed/Added and will be present in an upcoming release type: bug bug

Comments

@christooss
Copy link

Version of Dear PyGui

Version: 1.3.1
Operating System: Arch Linux

My Issue/Question

dpg.get_value on list box returns an item that was in the meantime delete if it was selected before deletion.

To Reproduce

Steps to reproduce the behavior:

  1. Have multiple options in listbox list = (A, B, C)
  2. Select option C
  3. Have widget with redifining the list in the listbox list = (A, B)
  4. dpg.get_value of listbox is C

Expected behavior

Even though GUI selects A (default behaivor of listbox that selects first element) get_value doesn't return it.

Standalone, minimal, complete and verifiable example

# Here's some code anyone can copy and paste to reproduce your issue
import dearpygui.dearpygui as dpg

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

def populate_the_list(sender, data):
    if data:
        dpg.configure_item("list", items=["A", "B", "C"])
        print(dpg.get_value("list")
    else:
        dpg.configure_item("list", items=["A", "B"])
        print(dpg.get_value("list"))


with dpg.window(label="tutorial"):
    dpg.add_listbox(tag="list", callback=populate_the_list)
    dpg.add_checkbox(callback=populate_the_list)


dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
@christooss christooss added state: pending not addressed yet type: bug bug labels Mar 6, 2022
@hoffstadt hoffstadt added priority: medium medium priority and removed state: pending not addressed yet labels Apr 21, 2022
@hoffstadt hoffstadt added state: ready Fixed/Added and will be present in an upcoming release and removed priority: medium medium priority labels Apr 25, 2022
@hoffstadt
Copy link
Owner

Fixed in next release.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
state: ready Fixed/Added and will be present in an upcoming release type: bug bug
Projects
None yet
Development

No branches or pull requests

2 participants