PHP code example of pgtk / gtk

1. Go to this page and download the library: Download pgtk/gtk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pgtk / gtk example snippets




use PGtk\Gtk\Gtk\Window;
use PGtk\Gtk\Gtk\HeaderBar;
use PGtk\Gtk\Gtk\Label;
use PGtk\Gtk\GLib\MainLoop;

$run = true;

$window = new Window();
$window->widget->setSizeRequest(100, 100);
$window->setTitle('Window');

$headerBar = new HeaderBar();
$headerBar->setDecorationLayout('menu:close');
$window->setTitlebar($headerBar);

$label = new Label('label');

$window->setChild($label);

$loop = new MainLoop();
$window->connect('destroy', function (Window $window, MainLoop $loop) {
    $loop->quit();
}, $loop);

$window->widget->show();

$loop->run();