G
Graham Feeley
Hi I am a Newbie and trying to get a menu to work.
I have place 3 buttons so far on a form, however I would like to know how to
place them where I want them.
EG: on this form I would like the buttons to be on the bottom of the form
and in one row????
Any help would be appreciative!!
------------------
#!/usr/bin/perl -w
# Display Hello World program
use diagnostics;
use Tk;
use strict;
use warnings;
my $font1 = "arial 10 bold";
my $font2 = "courier 12 bold";
my $mw = MainWindow->new;
$mw->geometry("1024x512");
$mw->title("GUI Test");
my $frame1 = $mw->Frame(-width=>1024,
-height=>128,
-relief=>"raised")->grid();
my $btn1 = $mw->Button(-text=>"Exit",
-font=>$font2,
-width=>9, # width of the button in screen
units
-height=>3, # height of the button in screen
units
-relief=>"raised", # raised solid ridge sunken flat
groove
-state=>"normal", # normal active or disabled
-command =>sub{exit})
->grid( -pady=>10);
my $btn2 = $mw->Button(-text=>"Btn2",
-font=>$font2,
-width=>9, # width of the button in screen units
-height=>3, # height of the button in screen units
-relief=>"raised", # raised solid ridge sunken flat groove
-state=>"normal", # normal active or disabled
-command =>sub{exit})
->grid( -pady=>10);
my $btn3 = $mw->Button(-text=>"Btn3",
-font=>$font2,
-width=>9, # width of the button in screen units
-height=>3, # height of the button in screen units
-relief=>"raised", # raised solid ridge sunken flat groove
-state=>"normal", # normal active or disabled
-command =>sub{exit})
->grid( -pady=>10);
MainLoop;
I have place 3 buttons so far on a form, however I would like to know how to
place them where I want them.
EG: on this form I would like the buttons to be on the bottom of the form
and in one row????
Any help would be appreciative!!
------------------
#!/usr/bin/perl -w
# Display Hello World program
use diagnostics;
use Tk;
use strict;
use warnings;
my $font1 = "arial 10 bold";
my $font2 = "courier 12 bold";
my $mw = MainWindow->new;
$mw->geometry("1024x512");
$mw->title("GUI Test");
my $frame1 = $mw->Frame(-width=>1024,
-height=>128,
-relief=>"raised")->grid();
my $btn1 = $mw->Button(-text=>"Exit",
-font=>$font2,
-width=>9, # width of the button in screen
units
-height=>3, # height of the button in screen
units
-relief=>"raised", # raised solid ridge sunken flat
groove
-state=>"normal", # normal active or disabled
-command =>sub{exit})
->grid( -pady=>10);
my $btn2 = $mw->Button(-text=>"Btn2",
-font=>$font2,
-width=>9, # width of the button in screen units
-height=>3, # height of the button in screen units
-relief=>"raised", # raised solid ridge sunken flat groove
-state=>"normal", # normal active or disabled
-command =>sub{exit})
->grid( -pady=>10);
my $btn3 = $mw->Button(-text=>"Btn3",
-font=>$font2,
-width=>9, # width of the button in screen units
-height=>3, # height of the button in screen units
-relief=>"raised", # raised solid ridge sunken flat groove
-state=>"normal", # normal active or disabled
-command =>sub{exit})
->grid( -pady=>10);
MainLoop;