image - PHP GTK button click -


I'm trying to change this button background when You click it and this is what I have:

  & lt ;? Php if (! Class_exists ('gtk')) {Dead ("Please load php-gtk2 module in your php.ini \ r \ n";); } Function location () {return dynamism (__ file__); }; $ Wnd = new GtkWindow (); $ Wnd-> Set_top ('image viewer'); $ Wnd-> Set_resizable (wrong); $ Wnd-> Set_position (GTK_WIN_POS_CENTER); $ Wnd-> Connect_system ('deleted', array ('gtk', 'main_quit')); $ Im = GtkImage :: new_from_file (loc (). "\ Bg.jpg"); $ Btn = new gtk button; $ Btn- & gt; Set_image ($ im); $ Btn- & gt; Clicked (function () {$ im = GtkImage :: new_from_file (loc (). "\ Bg2.jpg"); $ btn- & gt; set_esize ($ im);}); $ Wnd-> Add ($ btn); $ Wnd-> Show_all (); Gtk :: main (); ? & Gt;  

Why does not this work?

I think $ btn-> gt; ; Clicked (function () { part is the problem.

emits $ btn-> clicked > on the signed signal. What you want to do connect a function for the signal: Connected ('clicked', 'change_background'); function changes_background ($ billboard) {$ im = GtkImage :: new_from_file (loc (). "\" Bg2.jpg "); $ pocket-> set_isize ($ im);}

Comments