What is GTK? Boxes, buttons, and sliders, oh my!
GTK was... GTK is... Original UI toolkit for GIMP. GIMP Tool Kit Now the basis of GNOME and lots of software. GNOME Tool Kit. (sarcastic groan) C Library. Bindings in almost any language ever C++, D, ... Java, Python, Perl, ... Oh, and PHP
GTK Applications GIMP GNOME anything. Transmission Banshee Pidgin Apps roll custom UI kits for GTK or QT purists Firefox, The suite formerly known as OpenOffice.
PHP-GTK is... A client side application library. Will not run in a webserver. In fact your webserver will catch fire. I have seen it happen twice. NOT for building webpages. Remember: fire.
PHP-GTK Pros PHP is easy fun. PHP Object Orientation fits well with a widget toolkit mindset. Linux systems probably already have PHP CLI accessible. Multiplatform. Download unzip and go on Windows. Package manager + some compiling on Linux. MacOS is not fun to setup. But it can happen.
PHP-GTK Cons PHP is “slow” PHP is kind of single thread mostly. Windows users are like “lolwut?” The concept of an exe binary does not exist. Actually it does, but it is the official position of the devs to not even attempt to support blendering. Perfectly reasonable way around this MacOS is a pain to setup. 4:39:15 PM Greg: So let me see, you used Linux software to run the Windows binaries of Linux libraries through a web programming language on Mac... so that you could use a text editor? 4:39:34 PM Bob: yeah :D
Quick peek at some PHP-GTKs <?php //. FAR from a proper app, //. but will “work”. $window = new GtkWindow; $window->add(new GtkLabel( ‘Hello World’ )); $window->set_title(‘Hurr Durr’); $window->show_all(); Gtk::main(); ?>
What can we do with php-gtk? The right answer is almost anything.
quick pre-demo pointers lets see some code already.
Desktop App Requirements Applications must know how to initialize themselves. Loading, caching, building UI, handling input. Applications must know how to terminate themselves cleanly. SEGFAULT is not a valid choice, though humorous. Clean up files, swaps, connections, last second saves, etc.
How it works... Execute PHP application PHP app loads whatever config, init whatever UI, and exposes itself to you PHP app hits the main loop Gtk::main(); This keeps your script alive in the GTK loop so that it can answer to things like mouse clicks. PHP app breaks the loop when done. Gtk::main_quit();