Change Background color of GtkWindow in PHP GTK

|
Many People often want to change background color of GtkWindow in PHP GTK. Here is a simple example.

In below example, we use  void modify_bg( GtkStateType state , GdkColor color ); for set background color of GtkWindow. According to PHP-GTK 2 Manual GtkStateType indicates the current state of a widget; the state determines how the widget is drawn. The GtkStateType enumeration is also used to identify different colors in a GtkStyle for drawing, so states can be used for subparts of a widget as well as entire widgets.

For more information follow below links.
GtkStateType
GdkColor

<?php
/* 
PHP GTK tutorials
website: http://phpgtktutorials.blogspot.in/
*/
$window = new GtkWindow();
$window->set_size_request(400, 100);
$window->modify_bg(Gtk::STATE_NORMAL, GdkColor::parse("#FFFF00"));
$window->connect_simple('destroy', array('Gtk','main_quit'));
$label = new GtkLabel("hello buddy!");
$window->add($label);
$window->show_all();
Gtk::main();
?>

0 comments:

Post a Comment