?
Solved

Perl/Tk resizing windows etc

Posted on 2004-11-01
5
Medium Priority
?
1,370 Views
Last Modified: 2008-01-09
I have just started trying to learn perl/tk

I have the following code ...

#!/usr/bin/perl
require Tk;
use Tk;
my $main = MainWindow->new();

my $lr_frame = $main->Frame(-background=>'cyan')->pack(-side=>'top',-fill=>'both');

my $left_box = $lr_frame->Scrolled('Text',
                                   -scrollbars=>'oe',
                                   )->pack(-side=>'left',-fill=>'both', -expand=>1);


my $right_box = $lr_frame->Scrolled('Text',
                                   -scrollbars=>'oe',
                                   )->pack(-side=>'left', -fill=>'both',  -expand=>1);

MainLoop();

++++++++++++++++++++++++
so basically when I run the above  I get two textbox .. which does look as if both has 50% of the window share ..
but when I maximize the window it doesnt look like that one textbox is larger than the other ..How can I ensure that both textboxes are of the same size ?

also any pointers/urls to good online perl/Tk tutorials  would be appreciated

Thanks,
abhijit
0
Comment
Question by:avizit
  • 2
  • 2
5 Comments
 
LVL 15

Assisted Solution

by:nicholassolutions
nicholassolutions earned 400 total points
ID: 12471245
0
 
LVL 5

Accepted Solution

by:
ITcrow earned 800 total points
ID: 12479194
#! /usr/local/bin/perl -w
use Tk;

my $main = MainWindow->new();

my $lr_frame = $main->Frame(-background=>'cyan')->pack(-side=>'top',-fill=>'both');

my $left_box = $lr_frame->Scrolled('Text', -scrollbars=>'oe',);
my $right_box = $lr_frame->Scrolled('Text', -scrollbars=>'oe',);

# Use Grid
$left_box->grid( -in => $lr_frame, -row=>1,-column => '1', -sticky => 'nesw' );
$right_box->grid( -in => $lr_frame, -row=>1,-column => '2', -sticky => 'nesw' );

$lr_frame->gridRowconfigure(1, -weight=>1, -minsize =>50 );
$lr_frame->gridColumnconfigure(1, -weight=>1, -minsize =>50 );
$lr_frame->gridColumnconfigure(2, -weight=>1, -minsize =>50 );

MainLoop();
0
 
LVL 11

Author Comment

by:avizit
ID: 12479419
Thanks for the links nicholassolutions
ITcrow , your solution works fine , but any idea if the same can be done using "pack" . I will wait for a day more if any more suggestions comes , else I will split the points amongts you two.

Thanks ,
Abhijit

0
 
LVL 5

Expert Comment

by:ITcrow
ID: 12500821
Hello Abhi,

Pack doesn't really give very well defined mechanism to get full control on GUI. The method I proposed gives you full control on how and where you want to place your GUI elements.

0
 
LVL 11

Author Comment

by:avizit
ID: 12500832
Thanks ITcrow , seems like now i have to start looking at grids ..luckily i have just started .. so not much harm done :)
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

599 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question