Gtk2-perl
Encyclopedia
Gtk2-Perl is a set of wrapper
Wrapper
Wrapper generally refers to a type of packaging, such as a flat sheet made out of paper, cellophane or plastic to enclose an object.Wrapper may also refer to:* Wrapper , a woman's garment which is worn over nightwear or lingerie...

s for the Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...

 programming language around the GTK+
GTK+
GTK+ is a cross-platform widget toolkit for creating graphical user interfaces. It is licensed under the terms of the GNU LGPL, allowing both free and proprietary software to use it. It is one of the most popular toolkits for the X Window System, along with Qt.The name GTK+ originates from GTK;...

 GUI
Gui
Gui or guee is a generic term to refer to grilled dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients. The term derives from the verb, "gupda" in Korean, which literally...

 library
Library (computer science)
In computer science, a library is a collection of resources used to develop software. These may include pre-written code and subroutines, classes, values or type specifications....

 and the other GNOME
GNOME
GNOME is a desktop environment and graphical user interface that runs on top of a computer operating system. It is composed entirely of free and open source software...

 platform libraries. GTK2-Perl is free software
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...

 and licensed under the LGPL. Developers and interested parties can usually be found on the IRC
Internet Relay Chat
Internet Relay Chat is a protocol for real-time Internet text messaging or synchronous conferencing. It is mainly designed for group communication in discussion forums, called channels, but also allows one-to-one communication via private message as well as chat and data transfer, including file...

 channel #gtk-perl on irc.gnome.org.

Gtk2-Perl is part of the official GNOME Platform Bindings release, along with C++ bindings
Gtkmm
gtkmm is the official C++ interface for the popular GUI library GTK+. gtkmm is free software distributed under the GNU Lesser General Public License ....

, Python bindings
PyGTK
PyGTK is a set of Python wrappers for the GTK+ graphical user interface library. PyGTK is free software and licensed under the LGPL. It is analogous to PyQt and wxPython which are python wrappers for Qt and wxWidgets respectively. Its original author is the prominent GNOME developer James Henstridge...

 and Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 bindings.

Example


use Gtk2 '-init';

$window = Gtk2::Window->new('toplevel');
$window->set_title("Hello World!");

$button = Gtk2::Button->new("Press me");
$button->signal_connect(clicked => sub { print "Hello again - the button was pressed\n"; });

$window->add($button);
$window->show_all;

Gtk2->main;

0;


The sample program creates a GTK+ Window titled "Hello World!". The window contains a Button labelled "Press me." When the button is pressed, the message "Hello again - the button was pressed" is displayed on the console via the callback
Callback (computer science)
In computer programming, a callback is a reference to executable code, or a piece of executable code, that is passed as an argument to other code. This allows a lower-level software layer to call a subroutine defined in a higher-level layer....

 inside the anonymous subroutine
Subroutine
In computer science, a subroutine is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code....

connected to the "clicked" signal.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK