Alignment of text within a label
- From: ofey aikon <ofey aikon gmail com>
- To: gtk-perl mailing list <gtk-perl-list gnome org>
- Subject: Alignment of text within a label
- Date: Sat, 23 Apr 2005 19:11:43 -0700
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]