WorldDrknss Posted July 5, 2007 Share Posted July 5, 2007 I am in the process of learning PHP-GTk and having a problem with buttons. When I click on a button my app closes instead of echoing out the content. This is what I have: <?php if (!class_exists('gtk')) { dl('php_gtk.' . (strstr(PHP_OS, 'WIN') ? 'dll' : 'so')); } $window = new GtkWindow(); $window->set_position(GTK_WIN_POS_CENTER); $window->set_usize((gdk::screen_width()/2), (gdk::screen_height()/2)); $window->set_title("Some Title"); $window->connect('destroy', array('Gtk','main_quit')); $hbox = new GtkHBox(); $start_btn = new GtkButton('Start'); $start_btn->connect('clicked', 'server_start'); $hbox->pack_start($start_btn); $stop_btn = new GtkButton('Stop'); $stop_btn->connect('clicked', 'server_stop'); $hbox->pack_start($stop_btn); $close_btn = new GtkButton('Close'); $close_btn->connect('clicked', 'app_close'); $hbox->pack_start($close_btn); function server_start(){ echo "Start\n"; } function stop_server(){ echo "stop\n"; } function app_close(){ gtk::main_quit(); } $window->add($hbox); $window->show_all(); Gtk::main(); ?> Link to comment https://forums.phpfreaks.com/topic/58511-gtk-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.