GtkLabel Constructor

GtkLabel ([string string = null [, boolean parse_mnemonic = false]]);

Creates a new label with an (optional) text. If you set the parse_mnemonic to true, the label will set the mnemonic key to the first letter right to the first underscore _.

Example 77. Creating a GtkLabel

<?php
function rotate($label) {
    $label->set_label(
        $label->get_angle()
        . ' label text - this <b>is</b> a' 
        . '<span foreground="#F00">very long label</span>'
        . 'so we can see <span background="green" size="larger"'
        . ' weight="bold">rotation</span> better'
    );
    $label->set_angle($label->get_angle() + 1);
    return true;
}

$wnd = new GtkWindow();
$wnd->set_default_size(500,500);
$wnd->set_title('GtkLabel::set_angle');
$wnd->connect_simple('destroy', array('Gtk', 'main_quit'));

$label = new GtkLabel('t_est', true);
$label->set_use_markup(true);

$wnd->add($label);
$wnd->show_all();

Gtk::timeout_add(50, 'rotate', $label);
Gtk::main();
?>