Widget Alignment



Hi!

I'm struggling with widget alignment. Running the attached code (apologies for its length), I don't 
understand why the Device and Paper size labels don't line up with the left hand side of the window, or 
indeed why the two radiobuttons are not exactly aligned.

Any help appreciated!

Jeff

#!/usr/bin/perl -w

use strict;
use Gtk2 -init;

my $window = Gtk2::Window -> new;
$window -> set_border_width(10);
$window -> signal_connect (delete_event => sub { Gtk2 -> main_quit; });

my $vbox = Gtk2::VBox -> new;
$window -> add ($vbox);

my $hboxd = Gtk2::HBox -> new;
$vbox -> pack_start ($hboxd, 1, 1, 0);

my $labeld = Gtk2::Label -> new ("Device");
$hboxd -> pack_start ($labeld, 1, 1, 0);

my $optd = Gtk2::OptionMenu -> new;
my $menud = Gtk2::Menu -> new;

foreach (qw/ scanner1 scanner2 scanner3/) {
 my $item = Gtk2::MenuItem -> new ($_);
 $item -> show;
 $menud -> append ($item);
}
$optd -> set_menu ($menud);
$hboxd -> pack_end ($optd, 1, 1, 0);
   
my $hboxp = Gtk2::HBox -> new;
$vbox -> pack_start ($hboxp, 1, 1, 0);

my $labelp = Gtk2::Label -> new ("Paper size");
$hboxp -> pack_start ($labelp, 1, 1, 0);

my $optp = Gtk2::OptionMenu -> new;
my $menup = Gtk2::Menu -> new;
foreach (qw/A4 Letter Custom/) {
 my $item = Gtk2::MenuItem -> new ($_);
 $item -> show;
 $menup -> append ($item);
}
$optp -> set_menu ($menup);
$hboxp -> pack_end ($optp, 1, 1, 0);

my $frame = Gtk2::Frame -> new('# Pages');
$vbox -> pack_start ($frame, 1, 1, 0);
my $vboxn = Gtk2::VBox -> new;
$vboxn -> set_border_width(6);
$frame -> add ($vboxn);

my $buttona = Gtk2::RadioButton -> new(undef, "All");
$vboxn -> pack_start($buttona, 1, 1, 0);
$buttona -> set_active(1);
$buttona -> show;
my @group = $buttona -> get_group;

my $hboxn = Gtk2::HBox -> new;
$vboxn -> pack_start($hboxn, 1, 1, 0);
my $buttone = Gtk2::RadioButton -> new(@group);
$hboxn -> pack_start($buttone, 1, 1, 0);
$buttone -> show;

my $entry = Gtk2::Entry -> new;
$hboxn -> pack_end ($entry, 1, 1, 0);

my $hboxb = Gtk2::HBox -> new;
$vbox -> pack_start ($hboxb, 1, 1, 0);

my $sbutton = Gtk2::Button -> new('Scan');
$hboxb -> pack_start( $sbutton, 1, 1, 0 );
my $device;

my $cbutton = Gtk2::Button -> new_from_stock('gtk-cancel');
$hboxb -> pack_end( $cbutton, 0, 0, 0 );

$window -> show_all;
Gtk2 -> main;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]