DearPyGui
DearPyGui copied to clipboard
set_value() to a button in a file_dilaog callback doesn't work
Version of Dear PyGui
Version: 1.11.1 Operating System: Windows 10
My Issue/Question
When I try to use set_value() to a button within a callback for a file_dialog(), the button's value is not set.
To Reproduce
Steps to reproduce the behavior:
- Create a button
- Create a hidden file_dialog window
- Create a file_select function with the arguments of sender and app_data to set the value of the button to app_data["file_path_name"] then print the get_value of the button
- Set a callback on the button to show file_dialog window
- Set the file_dialog function as the callback to the file_dialog
- Run the python script, click the button, select a file, and check on the print statements.
Expected behavior
The print statement will have an output of "None"
Screenshots/Video
Standalone, minimal, complete and verifiable example
import dearpygui.dearpygui as dpg
def file_select(sender, app_data):
print(app_data)
dpg.set_value("button", app_data["file_path_name"])
print(dpg.get_value("button"))
dpg.create_context()
dpg.create_viewport(title='Test For Set Value', width=600, height=200)
dpg.setup_dearpygui()
with dpg.window(label="Test"):
dpg.add_button(
label="button",
tag="button",
callback=lambda: dpg.show_item("file_dialog")
)
with dpg.file_dialog(show=False, label="choose a file",
tag="file_dialog", callback=file_select):
dpg.add_file_extension(".*")
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()