PHP-GTK

Yesterday I decided that I may start to learn PHP-GTK again, but properly this time. I want to create desktop applications, but I do not wish to learn anything like C++, and because I already know PHP very well, all I need to learn is the GTK side of things, which is easier said then done. There isn’t many tutorials at the moment, and the official documentation has not been completed, but it’s slowly getting popular I think, just need a good compiler to create standalone applications. Saying that, there is one out there, only problem is it doesn’t support PHP-GTK2, though I heard there will be a release sometime soon.

Here is an example of what the code looks like…

class hello extends GtkWindow {

   public function __construct(){
      parent::__construct();

      $this -> create_app();
      $this -> set_destroy();
      $this -> show();
   }

   public function set_destroy(){
      $this -> connect_simple(”destroy”, array(
         ”gtk”,
         ”main_quit”
      ));
   }

   public function create_app(){
      $this -> set_title(”Hello World”);
      $this -> set_position(Gtk::WIN_POS_CENTER);      

      $lbl = new GtkLabel(”Hello World”);
      
      $this -> add($lbl);
   }

   public function show(){
      $this -> show_all();

      Gtk::main();
   }
}

new hello();

?>
What better way to start than with “Hello World” :p.

I’m not sure what the limits are, but I’ve seen a web browser application done with it that embeds a Mozilla browser window using GtkMozEmbed…

http://www.mozilla.org/unix/gtk-embedding.html

So yeah, pretty cool stuff, something I want to get my teeth into :)

Sunday, October 22nd, 2006 PHP-GTK

1 Comment to PHP-GTK

  1. Hi,
    yes PHP-GTK is good for GUI developing

    There is nice book at apress
    “pro PHP-GTK”
    good luck

  2. sudath on December 15th, 2006

Leave a comment

What Am I Doing?

Search

 

Categories