Alignment of text within a label



How do I get the text in a label aligned to the left rather than to
the middle. In the following example, I have a vbox and I want the
text of both labels to be left aligned.

I guess packing an empty label to the right of each label will do the
trick, but is there something simpler that I am missing here ?

-------------------------------

#!/usr/bin/perl -w

use strict;
use Gtk2 -init;
use Glib qw /TRUE FALSE/;

my $vbox = Gtk2::VBox->new(FALSE);
my $small = Gtk2::Label->new('small phrase');
my $large = Gtk2::Label->new('really loooooooooooong phrase');

$small->set_justify('left'); # I thought this'll do it but it doesn't
(something about multiple lines in the documentation)
$large->set_justify('left');

$vbox->pack_start($small, FALSE, FALSE, 0);
$vbox->pack_start($large, FALSE, FALSE, 0);

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

$window->add($vbox);

$window->set_default_size(200,50);
$window->show_all;
Gtk2->main;
------------------------------



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