• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 846
  • Last Modified:

Bring window to front in Tk GUI in Windows

I have some code that uses Tk. It launches a word document then closes it. Problem is when it closes the word document the tk window falls back to where other apps are on top of it. I need the tk window to be the top most window after the word document closes. I tried focus, grab, etc... and I haven't found any way in windows to bring the tk window in front of all other windows so its in the users face. Thanks! Any advice or simple code I can add to do this?

use Tk;
$mw = MainWindow->new();

#Open document....
#Does some stuff....
#Close Document....
#Now I want the $mw to jump out in front of the users face on top of all other windows whether they are Tk perl related or lets say firefox, internet explorer, excel, etc....

Open in new window

1 Solution
Carl BohmanCommented:
I've never used it before, but there appears to be a module for that:

Even if you don't use the module, you might be able to look at the source code and find a way that works for you.

The basic approach I would try is to turn on the "stay on top" feature for your window (which should force your window to the top), then immediately turn that off (unless you have a good reason to keep it on).

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now