First of all, don't use multiple MainWindows. It's certainly possible, but parts of Tk aren't reliable when used with multiple MainWindows. Your best bet is to use Toplevels. You create one MainWindow and then create the other windows by making Toplevels from the MainWindow
my $win = $mw->Toplevel(-title => 'ererree');
If you don't want to have one and only one MainWindow (remember that closing a MainWindow exits your program), you can use only Toplevels and call $mw->withdraw immediately after creating the MainWindow. Your MainWindow will then be invisible and you'll only have Toplevels, which can be closed without requring the program to end.
As far as your actual question, try $win->focus, where $win is the name of the window you want to bring to the front.
The computer can't tell you the emotional story. It can give you the exact mathematical design, but what's missing is the eyebrows.
- Frank Zappa
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|