PHP GTK button click

NeelixF

New Member
I'm trying to make this button change background when you click it and this is what I have:\[code\]<?phpif (!class_exists('gtk')) { die("Please load the php-gtk2 module in your php.ini\r\n");}function loc(){ return dirname(__FILE__);};$wnd = new GtkWindow();$wnd->set_title('Picture Viewer');$wnd->set_resizable(false);$wnd->set_position(GTK_WIN_POS_CENTER);$wnd->connect_simple('destroy', array('gtk', 'main_quit'));$im = GtkImage::new_from_file(loc()."\bg.jpg");$btn = new GtkButton;$btn->set_image($im);$btn->clicked(function(){ $im = GtkImage::new_from_file(loc()."\bg2.jpg"); $btn->set_image($im);});$wnd->add($btn);$wnd->show_all();Gtk::main();?>\[/code\]Why doesn't this work?I think that the \[code\]$btn->clicked(function(){\[/code\] part is the problem.
 
Back
Top