#native_company# #native_desc#

Getting Started with PHP-GTK: Part 1 Page 2

By Ray Hunter
on August 26, 2004

Getting Started: Simple Example
Here is a simple example with a window and a button. This is a modified version of the hello.php example
found in the test directory of the PHP-GTK source. Here is the example code:


// verify extension

if (!extension_loaded('gtk')) {


} else {

"PHP-GTK extension did not load.n");


// event function

function buttonClick($window)


"Hello PHP-GTK World!n";


// Window

$window = &new GtkWindow();



$window->set_title("Simple Example");


// Button

$button = &new GtkButton('Hello PHP-GTK World!');



// Tooltip

$tooltip = &new GtkTooltips();


$tooltip->set_tip($button,'Click Here!','Private tooltip.');