I need to ask the user for an arbitrarily long list of key-folder pairs, so I use Toplevel to create a popup where i lay out a growable list pairs of custom buttons (one to bind the key and one to select the folder).
I’d then like to wait til the user closes the window and read the status on the widgets, but wait_window() waits until it’s too late and the widgets are already deconstructed
Is there an easy way to do something like popup.wait_window() and access the attributes in the widgets?
EDIT: My ideal solution would be a single function like popup_bindings() that creates the popup and returns the value, so I could assign a variable directly with bindings = popup_bindings()
EDIT 2: Right now I’m focusing on the popup return value aspect, I will build the actual dialog after I’ve figured that out
I’ve come up with a relatively inelegant solution: I use a list as a mutable “callback” variable that’s preserved when the object is destroyed, and I use the protocol method to ensure that the value is saved when the window is closed.
I do not want to use buttons. I do not want to use function to get the list box selected item. if function used I want to use it directly for example x=getlistboxvalue()
Hiw can thia be done??
All examples I have seen are not professional. they are using the function to get the vale and print it or use it in a calculation. What if I have 10 list box widgets? shall I write 10 functions how if I want to use those 10 values to insert a row in a table in the database? please help