Приглашаем посетить
Екатерина II (ekaterina-ii.niv.ru)

13.17 PHP-GTK

Previous Table of Contents Next

13.17 PHP-GTK

One advanced use of the CLI PHP interpreter is to use it along with the PHP-GTK functions, which let you write full-featured GUI applications. The existing version of PHP-GTK (1.0.0) works with PHP 4. A new version of PHP-GTK is in the works for PHP 5.

Example 13-21 uses PHP-GTK to display a window with a button in it.

Example 13-21. Displaying a button with PHP-GTK
$window =& new GtkWindow( );



$button =& new GTKButton('I am a button, please click me.');

$window->add($button);



$window->show_all( );



function shutdown( ) { gtk::main_quit( ); }

$window->connect('destroy','shutdown');



gtk::main( );

The window that Example 13-21 displays is shown in Figure 13-2.

Figure 13-2. Displaying a button with PHP-GTK
figs/lphp_1302.gif


Read about PHP-GTK in O'Reilly's PHP Cookbook, Recipes 20.5-20.8 and 20.10; and at http://gtk.php.net.

    Previous Table of Contents Next