You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
I expected to get the path to a .csv file. I'm essentially creating a config window that has several other items, and when a user presses the "run" button, I expected to get the values of all the child items of the window.
So did I get it correctly that you're trying to save values obtained via the file_select callback in order to access them later? If so,
You can use dpg.set_item_user_data() instead of set_value(). This way you'll be able to retrieve the value later with dpg.get_item_user_data().
You can store the value in a global variable or a class member. This will probably be more convenient (especially with a class member) than set_item_user_data. BTW if you specify a member function as a DPG callback, that function does receive self and can therefore access member fields. That is, storing or retrieving the value is just one line like this:
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:
Expected behavior
The print statement will have an output of "None"
Screenshots/Video
Standalone, minimal, complete and verifiable example
The text was updated successfully, but these errors were encountered: