I’ve written a generic function that puts up a dialog with an Entry widget. I am successful in getting the response but now I don’t know how to return that response to the calling method. Here is the dialog function:
Nowhere in your sample code do you actually call getString so I don’t
think you are actually getting the string at all.
Untested:
Change getString to remove the global line.
Change print(answer) to return answer.
Your dialog function needs to call getString, then return the result
it gets. I think adding return getString() after the last line will be
sufficient.
Then you can say:
myanswer = dialog(...) # Fill in the actual arguments.
If that’s not enough to solve your problem, I think we will need some
more information about how you are calling the dialog function and what
you do next.
You might also like to check out some of these links:
Thanks for the reply. That is what I did originally but ‘functions.dialog’ returns immediately rather than waiting for the response. The crux of the problem is I cannot figure out how to ‘wait’ for the dialog to return the result. Is there a tkinter method that blocks until the call back completes? How does that call back return the result to dialog and then the calling function?