Sr. Web Developer
mediabistro.com
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume

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();

?>
[ Next Page ]

[Page 1]  [Page 2]  


Comments:
problem with div tags in lotus notes.ravi05/29/08 09:54
php for beginner...fitri01/15/06 10:46
solution for the errormeenambigai05/03/05 02:38
RE: Getting Started With PHPJohnnyblaz01/23/05 19:52
file functionscijo01/19/05 08:31
Help needed- how to execute php in IIS serversivakumar01/19/05 00:07
RE: HACKERSMasterDrive01/10/05 06:28
RE: Getting Started With PHPHulton Biljon01/10/05 03:43
RE: Getting Started With PHPAnders Einar01/03/05 01:42
Changing Background ColorsEmanuel Smith12/29/04 17:43
Getting Started With PHPAndrew12/23/04 13:07
rooms in chatTerry12/04/04 08:22
reupload imageBharati11/25/04 01:40
Getting Started With PHPali11/24/04 14:29
classeshello11/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.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.