From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of ukhas
jean
Sent: 09 October 2006 09:21
To: Active Perl
Subject: query on TK

> Hi ...
>  
> I have been beating round the bush for this silly prob. for quite a
while; maybe itz time I ask the experts. I > am working on TK and wanted
my application window to be 500 pixel wide and of 500 height; so that
the UI is not > all cramped for space.
>  
> I wrote the foll. code and the application window becomes of this
size:-
> ********************************
> use Tk;
> use strict;
> use warnings;
> my $MW = MainWindow-> new();
> my $hello = $MW->Button( -text    => 'Exit', 
>         -command => sub {print STDOUT "**********EXITing*******";
exit;} ); 
>      $hello->pack; 
>    
> my $c = $MW->Canvas(-width => 500, -height => 500); 
>      $c->pack;
> 
> MainLoop;
>  
> *************************
>  
> But when i add one more button to the *canvas*, the application window
becomes tiny. This is the code for a new > button:-
>  
> my $jr_hello = $c->Button(-text => 'hi master'); 
>      $jr_hello->pack;
> 
> Q.1. How should I keep my application-window-size to 500 x 500, even
if a new button is added??

Good question.

I am not very familiar with the Canvas widget, but I suspect it is the
pack that is causing the problem. I don't think thats how you are
supposed to add things to a Canvas widget (you did intend to add a
button to a canvas?). You probably should use $c->createWindow instead
(see 'perldoc Tk::Canvas'). Also, see the widget demos, at least one of
the canvas ones adds a button to a canvas.

Minor nitpick. "use strict; use warnings;" work best at the start of the
script.

HTH

-- 
Brian Raven 


=================================
Atos Euronext Market Solutions Disclaimer
=================================
The information contained in this e-mail is confidential and solely for the 
intended addressee(s). Unauthorised reproduction, disclosure, modification, 
and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message do not 
necessarily reflect those of Atos Euronext Market Solutions.

L'information contenue dans cet e-mail est confidentielle et uniquement 
destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. 
Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail 
vous parvient par erreur, nous vous prions de bien vouloir prevenir 
l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre 
systeme. Le contenu de ce message electronique ne represente pas necessairement 
la position ou le point de vue d'Atos Euronext Market Solutions.

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to