|
Getting Started with PHP-GTK: Part 1
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:
<?php
// verify extension
if (!extension_loaded('gtk')) {
dl('php_gtk.'.PHP_SHLIB_SUFFIX);
} else {
exit("PHP-GTK extension did not load.\n");
}
// event function
function buttonClick($window)
{
echo "Hello PHP-GTK World!\n";
}
// Window
$window = &new GtkWindow();
$window->set_default_size(200,25);
$window->set_border_width(10);
$window->set_title("Simple Example");
$window->connect_object('destroy',array('gtk','main_quit'));
// Button
$button = &new GtkButton('Hello PHP-GTK World!');
$button->connect('clicked','buttonClick',$window);
$window->add($button);
// Tooltip
$tooltip = &new GtkTooltips();
$tooltip->set_delay(200);
$tooltip->set_tip($button,'Click Here!','Private tooltip.');
$tooltip->enable();
$window->show_all();
Gtk::main();
?>
| Comments: | ||
| problem with div tags in lotus notes. | ravi | 05/29/08 09:54 |
| php for beginner... | fitri | 01/15/06 10:46 |
| solution for the error | meenambigai | 05/03/05 02:38 |
| RE: Getting Started With PHP | Johnnyblaz | 01/23/05 19:52 |
| file functions | cijo | 01/19/05 08:31 |
| Help needed- how to execute php in IIS server | sivakumar | 01/19/05 00:07 |
| RE: HACKERS | MasterDrive | 01/10/05 06:28 |
| RE: Getting Started With PHP | Hulton Biljon | 01/10/05 03:43 |
| RE: Getting Started With PHP | Anders Einar | 01/03/05 01:42 |
| Changing Background Colors | Emanuel Smith | 12/29/04 17:43 |
| Getting Started With PHP | Andrew | 12/23/04 13:07 |
| rooms in chat | Terry | 12/04/04 08:22 |
| reupload image | Bharati | 11/25/04 01:40 |
| Getting Started With PHP | ali | 11/24/04 14:29 |
| classes | hello | 11/21/04 03:56 |
|
If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly. | ||


