tcltk-toolkit

Make tk_messageBox topmost


A simple question (Windows 10) .. I have short Wish script that immediately withdraws the main window and runs in the background. Upon finding a certain condition existing, pops up a tk_messageBox, and this works fine, except that the the messageBox is always behind whatever's on the desktop at the moment, they'll hear the Windows "ding" is all. Is there a way to force this pop up to the top?


Solution

  • There isn't an option for that.

    On Windows and macOS, Tk uses the system dialog classes for standard dialogs (like tk_messageBox). They have... limitations. In particular, on Windows it's quite common for such popup dialogs to not have permission to go up in front of unrelated applications (due to a history of much abuse by application developers).

    You might prefer to use the tk sysnotify command to tie into the system notification mechanisms, now that it is in a stable version of Tk. (I've yet to try it out, I admit!)