PHP code example of toknot / gtk
1. Go to this page and download the library: Download toknot/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/ */
toknot / gtk example snippets
class PHPGtk {
public static $gtkDllMap = [
self::GLIB_ID => ['name' => 'libglib', 'header' => ['glib'], ', 'header' => ['gtype', 'gobject']],
self::GTK_ID => ['name' => 'libgtk', 'header' => ['gtkfunc']],
self::GDK_ID => ['name' => 'libgdk', 'header' => ['gdk'], 'iro']],
self::ATK_ID => ['name' => 'libatk', 'header' => ['atk'], '
$gtk = \GTK\PHPGtk::gtk();
function activate()
{
global $gtk, $app;
try {
$window = $gtk->gtk_application_window_new($app);
$gtk->gtk_window_set_title($gtk->GTK_WINDOW($window), "Window");
$gtk->gtk_window_set_default_size($gtk->GTK_WINDOW($window), 200, 200);
$gtk->gtk_widget_show_all($window);
} catch(\Error $e) {
echo $e;
}
}
function main($argc, $argv) : int
{
global $gtk, $app;
$app = $gtk->gtk_application_new("org.gtk.example", 0);
$gtk->g_signal_connect($app, "activate", 'activate');
$gapp = $gtk->G_APPLICATION($app);
$status = $gtk->g_application_run($gapp, $argc, $argv);
$gtk->g_object_unref($app);
return $status;
}
return main($argc, $argv);