We've displayed a button in the previous example. Now we will respond to button clicks.
When a user presses the button, a signalclicked is generated. Think of signal as something php-gtk generates to inform you that something has occurred, in this example, the user has clicked the button.
By connecting the signal to a callback function, every time there is a 'clicked' signal, php-gtk will automatically call the callback function that you have connected.
1 2 3 4 5 6 7 8 9 10
<?php $window = new GtkWindow(); $window->connect_simple('destroy',array('Gtk','main_quit'));
$button = new GtkButton("click me!"); $button->connect('clicked', 'on_click'); // note 1