3 ms·
Check out http://tkdocs.com http://tkdocs.com to get started _properly_ with tkinter. The blocking thing you can do in two ways. First, put your blocking stuff
by markroseman 8y ago
Check out http://tkdocs.com http://tkdocs.com to get started _properly_ with tkinter.
The blocking thing you can do in two ways. First, put your blocking stuff in another thread and do it there, and when it's done call back into the main thread to tear down the alert.
The other way, to play nice with the event loop, is to do something like:
makemydialog()
Tk.update_idletasks() # process events so that the dialog shows up
do_my_stuff
teardown
If within do_my_stuff you can periodically call update() to process events, it'll give the appearance of being more responsive.
After you get a bit more experience with doing some GUI stuff, and if you want to have a more long-running GUI, it will become more natural to think of initiating everything in response to event handlers, as opposed to the batch model of running your program linearly from top to bottom.
- jimnotgym 8y agoYou have told me more in that message than the whole book I read on Tkinter, and all of the experts who told me I was using the wrong framework. Thank you. I guess looking at it, having a process that is going to take a few seconds and must block the user from progressing until it completes is perhaps not the scenario most tutorials envisage. Thanks again