Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tiling Toplevel widgets in my Perl GUI 2

Status
Not open for further replies.

nexus1001

IS-IT--Management
Sep 27, 2001
13
0
0
DE
Hello all,

I am having a problem finding a way to tile 3 windows (1 MainWindow and 2 Toplevels) in my application.
Whenever I launch my proggie, I get the windows cascaded one behind another.

ANY SUGGESTIONS?? please anyone I am really stuck on this one!
 
When I was developing an app, I ran into the same wall. I don't know if Tk provides a method of 'placing' the windows on the screen. I know what your talking about though and that IS annoying. If you find a solution, please post it here so we (read: I) can take advantage of it.

Good luck.

--Jim
 
Hi Jim,

I will let you know as soon as I have found an answer to this very annoying problem indeed.

 
Hello again all,

I found an answer to my question so I am posting it in case any of you are wondering how to manage multiple Perl/Tk windows...

the geometry method provides sizing and placement for toplevel widgets as well as the MainWindow widget;

$toplevel_widget->geometry(&quot;+<a>+<b>&quot;); #placement only.

a: pixel offset for upper left corner sideways
b: pixel offset for upper left corner downward

$toplevel_widget->geometry(&quot;<a>x<b>+<c>+<d>&quot;); #placement and size.

a: pixel offset for widget width
b: pixel offset for widget height
c and d: as in 1st example


Hope this helps Jim...worked fine for me.
 
Is this what you are looking for?

my $mw1 = MainWindow->new;
$mw1->configure(-title=>&quot;Application Title&quot;,
-background=>'light blue');
$mw1->geometry('750x600+[red]100+00[/red]');

my $mw2 = MainWindow->new;
$mw2->configure(-title=>&quot;Application Title&quot;,
-background=>'light blue');
$mw2->geometry('100x100+[red]200+100[/red]');

I think those overlap, but, you see the use of the geometry
method to control position. If you are trying to control the placement of widgets within a parent window, do that with pack or grid.
'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Yes it was what I was looking for and I just posted a thread on the usage of the geometry methosd.

Thanks goBoating,
 
So that method places the new window ON the windows desktop screen at the location specified? (Want to make sure I clearly understanding this)

--Jim
 
yep.
Code:
#!perl
use Tk;

my $mw1 = MainWindow->new;
$mw1->configure(-title=>&quot;Application Title&quot;);
$mw1->geometry('100x100+100+00');

my $mw2 = MainWindow->new;
$mw2->configure(-title=>&quot;Application Title&quot;);
$mw2->geometry('100x100+220+100');

MainLoop;

That code will produce two independent windows on your desktop. The second window ($mw2) will be down and to the right of the first window ($mw1).


'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
its kinda of neat to see experienced programmers learn new things....
you should give him a star jim =)
speaking of learning new things... and don't laugh.. but i haven't been able to find a faq about adding those smiley faces and text color changes? Can you use html tags for color changes or what? If anyone could point me in the right direction.....
 
[red]check below[/red] the text input box for the Emoticons/Smileys ;-) and Process TGML links.

'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Why yauncin, I would beleive you have something there... ;)

A star for the boatman.

--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top