void set_label(string str);

Sets the text of the label. The label is interpreted as including embedded underlines and/or Pango markup depending on the values of set_use_underline() and set_use_markup()

By default, use_markup is not activated - you've got to enable it before markup will be interpreted.

Example 85. Setting the Text of a GtkLabel with Pango Markup

function updateCounter($label)
    // Set the label to the current label plus one in a random color.
    $randColor = substr(dechex(rand()), 0, 6);
    $label->set_label('<span color="#' . $randColor . '">' . 
                      ($label->get_text() + 1) .

// Create a window to hold the label.
$window = new GtkWindow();

// Set up the window to close cleanly.
$window->connect_simple('destroy', array('Gtk', 'main_quit'));

// Create a label.
$label = new GtkLabel('0');

// Set the label to use markup.

// Create a button that will be used to increment the counter.
$button = new GtkButton('Click Me!');

// When the button is clicked, the counter should be updated.
$button->connect_simple('clicked', 'updateCounter', $label);

// Create a vbox to hold the label and button.
$vBox = new GtkVBox();

// Add the label & button to the box.

// Add the box to the window.

// Show the window and start the main loop.

See also: get_label() , set_text() , set_markup()