1Gtk2(3) User Contributed Perl Documentation Gtk2(3)
2
3
4
6 Gtk2 - Perl interface to the 2.x series of the Gimp Toolkit library
7
9 use Gtk2 -init;
10 # Gtk2->init; works if you didn't use -init on use
11 my $window = Gtk2::Window->new ('toplevel');
12 my $button = Gtk2::Button->new ('Quit');
13 $button->signal_connect (clicked => sub { Gtk2->main_quit });
14 $window->add ($button);
15 $window->show_all;
16 Gtk2->main;
17
19 Perl bindings to the 2.x series of the Gtk+ widget set. This module
20 allows you to write graphical user interfaces in a Perlish and object-
21 oriented way, freeing you from the casting and memory management in C,
22 yet remaining very close in spirit to original API.
23
25 The Gtk2 module allows a Perl developer to use the Gtk+ graphical user
26 interface library. Find out more about Gtk+ at http://www.gtk.org.
27
28 The GTK+ Reference Manual is also a handy companion when writing Gtk
29 programs in any language. http://developer.gnome.org/doc/API/2.0/gtk/
30 The Perl bindings follow the C API very closely, and the C reference
31 documentation should be considered the canonical source.
32
33 To discuss gtk2-perl, ask questions and flame/praise the authors, join
34 gtk-perl-list@gnome.org at lists.gnome.org.
35
36 Also have a look at the gtk2-perl website and sourceforge project page,
37 http://gtk2-perl.sourceforge.net
38
40 use Gtk2 qw/-init/;
41 use Gtk2 qw/-init -threads-init/;
42
43 -init
44 Equivalent to Gtk2->init, called to initialize GLIB and GTK+. Just
45 about every Gtk2-Perl script should do "use Gtk2 -init"; This ini‐
46 tialization should take place before using any other Gtk2 functions
47 in your GUI applications. It will initialize everything needed to
48 operate the toolkit and parses some standard command line options.
49 @ARGV is adjusted accordingly so your own code will never see those
50 standard arguments.
51
52 -threads-init
53 Equivalent to Gtk2::Gdk::Threads->init, called to initialze/enable
54 gdk's thread safety mechanisms so that gdk can be accessed from
55 multiple threads when used in conjunction with
56 Gtk2::Gdk::Threads->enter and Gtk2::Gdk::Threads->leave. If invoked
57 as Gtk2::Gdk::Threads->init it should be done before Gtk2->init is
58 called, if done by "use Gtk2 -init -threads-init" order does not
59 matter.
60
62 perl(1), Glib(3pm).
63
64 Gtk2::Gdk::Keysyms(3pm) contains a hash of key codes, culled from
65 gdk/gdkkeysyms.h
66
67 Gtk2::api(3pm) describes how to map the C API into Perl, and some of
68 the important differences in the Perl bindings.
69
70 Gtk2::Helper(3pm) contains stuff that makes writing Gtk2 programs a
71 little easier.
72
73 Gtk2::SimpleList(3pm) makes the GtkListStore and GtkTreeModel a lot
74 easier to use.
75
76 Gtk2::Pango(3pm) exports various little-used but important constants
77 you may need to work with pango directly.
78
79 Gtk2::index(3pm) lists the autogenerated api documentation pod files
80 for Gtk2.
81
82 Gtk2 also provides code to make it relatively painless to create Perl
83 wrappers for other GLib/Gtk-based libraries. See Gtk2::CodeGen, ExtU‐
84 tils::PkgConfig, and ExtUtils::Depends. If you're writing bindings,
85 you'll probably also be interested in Gtk2::devel, which is a supple‐
86 ment to Glib::devel and Glib::xsapi. The Binding Howto, at
87 http://gtk2-perl.sourceforge.net/doc/binding_howto.pod.html, ties it
88 all together.
89
91 The gtk2-perl team:
92
93 muppet <scott at asofyet dot org>
94 Ross McFarland <rwmcfa1 at neces dot com>
95 Torsten Schoenfeld <kaffeetisch at web dot de>
96 Marc Lehmann <pcg at goof dot com>
97 Göran Thyni <gthyni at kirra dot net>
98 Jörn Reder <joern at zyn dot de>
99 Chas Owens <alas at wilma dot widomaker dot com>
100 Guillaume Cottenceau <gc at mandrakesoft dot com>
101
103 Copyright 2003-2007 by the gtk2-perl team.
104
105 This library is free software; you can redistribute it and/or modify it
106 under the terms of the GNU Library General Public License as published
107 by the Free Software Foundation; either version 2 of the License, or
108 (at your option) any later version.
109
110 This library is distributed in the hope that it will be useful, but
111 WITHOUT ANY WARRANTY; without even the implied warranty of MER‐
112 CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
113 General Public License for more details.
114
115 You should have received a copy of the GNU Library General Public
116 License along with this library; if not, write to the Free Software
117 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307
118 USA.
119
120
121
122perl v5.8.8 2007-03-18 Gtk2(3)