server monitoring
+ Reply to Thread
Results 1 to 3 of 3

Thread: Beginner's Guide to PHP-GTK

  1. #1
    Join Date
    Sep 2006
    Posts
    1,649

    Beginner's Guide to PHP-GTK

    First off, what IS this PHP-GTK anyway?

    It is an application programming interface (API) that allows you to develop GUI applications using PHP and it's object-oriented programming concepts. It uses the The GIMP Toolkit, created by the makers of the popular graphics editor GIMP.

    Why would I want to make GUI apps in PHP anyway?

    Why not? PHP is already widely known as a web language used in developing web applications, and it is also used as a scripting language on the command line. It's fun for a PHP programmer to be able to create GUI applications with PHP. And all programmers program for fun (well, they should, at least).

    How do I get started?

    First, let's assume you are using Windows have PHP installed in C:\php. Now, let's visit the PHP-GTK website, specifically the download page.

    [url]http://gtk.php.net/download.php[/url]

    Download the latest Windows binary, which, as of now is 2.0.*

    [url]http://gtk.php.net/do_download.php?download_file=php-gtk-2.0.*-win*2-nts.zip[/url]

    Once you've downloaded it, extract the folder named php-gtk2 to C:\php. Your directory path should look like C:\php\php-gtk2.

    Now, create a .php file named test.php inside of the php-gtk2 folder. Put this code inside of the folder:

    [PHP]<?php
    // Create the window
    $window = new GtkWindow();

    // This insures a clean exit when the app is closed
    $window->connect_simple("destroy", array('Gtk', 'main_quit'));

    // Labels can be text. This one is just a simple sentence
    $label = new GtkLabel("Testing PHP GTK * 2 * 2");

    // Here we are changing the size of the window to *00x*00
    $window->set_size_request(*00, *00);

    // The label is being added to the window, so you wil see
    // the text in the our previous label inside the window
    $window->add($label);

    // This actually will display the window to us
    $window->show_all();

    // This keeps the window displayed (like a loop) and it is required
    Gtk::main();
    ?>[/PHP]

    Now, open up Command Prompt. Go to Start, then find the Run button. Click it, and type 'cmd' without the quotes into the box. The Command Prompt box should come up, in all of it's dark and ill-foreboding glory.

    Use the 'cd' command to change your current working directory (CWD) to C:\php\php-gtk2. Then type this:

    php test.php
    A simple *50x*00 textbox should appear with the words "Testing PHP GTK * 2 * 2". Congratulations, you've made your first GUI application in PHP!

    Okay... Making little textboxes is cool and all, but I wanna do more!

    I'm afraid I cannot cover all aspects of PHP-GTK here. There's a limitless amount of things that can be done with PHP-GTK, and if I went over them all here, this would change from a tutorial into a PHP-GTK user manual. But don't fret, because below I've given the best resources on PHP-GTK that Google can find!

    PHP+GTK2 Cookbook - This gives tons of examples, and is a great place to see how to do a specific task in PHP-GTK
    [url]http://www.kksou.com/php-gtk2/[/url]

    PHP-GTK Documentation - If at first you don't succeed, read, read the documentation. Not to mention the search bar at the top of the page allows you to search for a specific function (just like the PHP.NET website)
    [url]http://gtk.php.net/docs.php[/url]

    I hope you've enjoyed this tutorial and learned something!
    ~Moonbat
    "Workers of the world unite; you have nothing to lose but your chains." -Karl Marx

  2. #2
    rishisharma Guest
    It is an application programming interface (API) that allows you to develop GUI applications using PHP and it's object-oriented programming concepts. It uses the The GIMP Toolkit, created by the makers of the popular graphics editor GIMP.
    _______________________________________________________________
    [durl=http://www.moonbatdigitaltransitions.com]medium format digital[/durl] [durl=http://www.raleighdentimoonbatst.com]general dentistry raleigh[/durl]
    Last edited by Moonbat; 10-15-2008 at 05:43 PM. Reason: Filtered out links, the Moonbat way :D

  3. #3
    Join Date
    Sep 2006
    Posts
    1,649
    Quote Originally Posted by rishisharma View Post
    It is an application programming interface (API) that allows you to develop GUI applications using PHP and it's object-oriented programming concepts. It uses the The GIMP Toolkit, created by the makers of the popular graphics editor GIMP.
    Are you retarded? Not only are you trying to slip links in your post again (after I told you not to) you reply to me using the first part of my post. You could've at least pulled from Wikipedia or something. Banned, for being a retard and spamming (but mostly being a retard).
    "Workers of the world unite; you have nothing to lose but your chains." -Karl Marx

+ Reply to Thread

Similar Threads

  1. Moonbat's Guide to Getting a Job
    By Moonbat in forum Tutorials
    Replies: 13
    Last Post: 12-18-2019, 09:49 AM
  2. Career guide
    By barton456 in forum General discussion
    Replies: 1
    Last Post: 03-20-2013, 07:41 AM
  3. Welcome to the Internet, I'll be your guide.
    By Moonbat in forum General discussion
    Replies: 1
    Last Post: 02-07-2008, 04:47 AM
  4. Moonbat's Guide to SQL Injections
    By Moonbat in forum Tutorials
    Replies: 6
    Last Post: 01-04-2008, 02:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts