Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Perl/Tk resizing windows etc

Posted on 2004-11-01
5
Medium Priority
?
1,360 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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

618 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