hoffstadt / DearPyGui

Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies
https://dearpygui.readthedocs.io/en/latest/
MIT License
12.62k stars 669 forks source link

item_toggled_open_handler does not provide "app_data" to callback #2346

Open Yamahari opened 2 weeks ago

Yamahari commented 2 weeks ago

Version of Dear PyGui

Version: 1.11.1 Operating System: Window 10

My Issue/Question

item_toggled_open_handler does not provide "app_data" to callback

To Reproduce

  1. Open/Close the tree node

Expected behavior

"app_data" should contain the tag of the node that was clicked?

Standalone, minimal, complete and verifiable example

import dearpygui.dearpygui as dpg

def main():
    dpg.create_context()

    def toggle(sender, app_data, user_data):
        print(sender, app_data, user_data)

    with dpg.item_handler_registry(tag="widget_handler") as handler:
        dpg.add_item_toggled_open_handler(tag='toggle_handler', callback=toggle, user_data=1)

    with dpg.window(width=500, height=300):
        with dpg.tree_node() as tree_node:
            dpg.bind_item_handler_registry(tree_node, "widget_handler")

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

if __name__ == '__main__':
    main()