You only need to run .update_idletasks(), as there are no pending events to process.
This is not a tkinter issue. It is a known fact that there are undocumented annoying differences in tk behavior on different systems and even different versions thereof. In #34275, for instance, we had to add .update_idletasks for IDLE calltips to appear on Macs with recent tk versions.
For Windows, your code also needs entry.focus_set to be able to enter text, after the mbox is dismissed, without activating the widget with a click.
Indeed, the call is needed here on Mac with Python 3.7.0 and tk 8.6.8. Without it, the root window partially keeps the focus, in that the traffic lights remain light, and the messagebox only partially get the focus, in that the title and OK button are dimmed. One has to click on the box to highlight the title and OK. With the call, the root lights go out and the box is active, and can be dismissed with <Enter>.
There is an additional issue on current Mac. When the mbox is dismissed, focus does not return properly to the root and entry. They have to be clicked on. Since this is similar to the problem in #34120, and since Novel's issue on Windows is exactly like the 'have to go away and come back' part of #34120, I wonder if the model mbox needs an explicit grab release.
Kevin, since the mbox is created and destroyed within a call to the tk messageBox function we have no control of its operation. Perhaps you could check the tcl/tk code and see it if needs updating, as did the IDLE code.
|