Webhosting and cheap domain registration service
  

 Home

GtkLabel
Prev GtkLabel Constructor Next

GtkLabel Constructor

GtkLabel ([string label_text ]);

Example 20. Aligning the text in a GtkLabel

<?php
if( !extension_loaded('gtk')) {	
	dl( 'php_gtk.' . PHP_SHLIB_SUFFIX); 
}

$window = &new GtkWindow();
$window->set_default_size(300, 70);
$window->connect_object('destroy', array('gtk', 'main_quit'));

$label = &new GtkLabel("This is my label");
//move it to the lower right
$label->set_alignment(1.0, 1.0);

//give it a nice font and color
$style = $label->get_style();
$style->font = gdk::font_load( '-*-Arial-bold-r-normal-*-24-*-*-*-*-*-*-*');
$orange = &new GdkColor( '#FF8000');;
$style->fg[GTK_STATE_NORMAL] = $orange;
$label->set_style( $style);

//you can't set the background color of a label, use the parent widget instead
$wstyle = $window->get_style();
$wstyle->bg[GTK_STATE_NORMAL] = $wstyle->black;
$window->set_style( $wstyle);

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

gtk::main();
?>

The set_alignment() method is inherited from GtkMisc.


Prev Home Next
GtkLabel Up GtkLabel::set_text

 

  

Network sites:

Cheap domain registrar's cheap domain registration service

$8.95 domain registration : Buy domain name or register domain name 

 
 
Quotes:
The great thing in the world is not so much where we stand, as in what direction we are moving.  
 
 

Disclaimer: This documentation is provided only for the benefits of our webhosting customers.
For authoritative source of the documentation, please refer to http://gtk.php.net/docs.php