oio11: (Default)
[personal profile] oio11

Perl – GTK2 – Ubuntu 9.04



How to setup Gtk2 for perl in Ubuntu 9.04
You will need the following packages

sudo apt-get install build-essential
sudo apt-get install libgtk2.0-dev libglib2.0-dev libpango1.0-dev

Now run cpan

sudo cpan

Install the following in order

install ExtUtils::Depends
install ExtUtils::PkgConfig
install Glib
instal Pango
install Gtk2

And now you done, you can test it with the following script:

#!/usr/bin/perl
use Gtk2 -init;

my $window = Gtk2::Window->new ('toplevel');
my $button = Gtk2::Button->new ('Quit');
$button->signal_connect (clicked => sub { Gtk2->main_quit });
$window->add ($button);
$window->show_all;
Gtk2->main;


To run it save the script as gtk-test.pl and run

perl gtk-test.pl

from the command line.

A small window should open, with a Quit button inside.
http://www.allmyit.com.au/perl-gtk2-ubuntu-904

October 2025

S M T W T F S
   1234
567891011
12131415161718
19202122 232425
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Mar. 23rd, 2026 09:07 am
Powered by Dreamwidth Studios