Alex Rivera | Logout

What are good interactive GUI builder packages for Perl?

Asked 2009-03-30T00:53:40.127
12

I'd like to write some interactive GUIs in Perl. I've used TclTk but it looks dated. I've written QT code for C++, but the PerlTk module hasn't had a release in several years. Googling around I see other possible options.

What are good packages for this, including basic windowing, menus, drawing canvas, scrollbars, and so on.

Edit
Report

3 Answers

13

Gtk2 has glade2 which can write out an XML file usable by Gtk2::GladeXML. Here is an example of how to bundle the XML with the app in the same file.

I misread the question at first. I thought you wanted a GUI editor for making GUIs (which is what glade2 is). You can also create GUIs using Gtk2 without glade2:

#!/usr/bin/perl

use strict;
use warnings;
use Gtk2;

Gtk2->init;

my $window = Gtk2::Window->new;
my $vbox   = Gtk2::VBox->new;
my $label  = Gtk2::Label->new("Hello World");
my $button = Gtk2::Button->new("Press me");

$window->add($vbox);
$vbox->add($label);
$vbox->add($button);

$window->set_default_size(200, 200);
$window->signal_connect(
    destroy => sub {
        Gtk2->main_quit;
    }
);

my $i = 0;
$button->signal_connect(
    clicked => sub {
        $label->set_text("button pressed " . ++$i . " times");
    }
);

$window->show_all;

Gtk2->main;
answered 2009-03-30T03:04:30.560
0

The solution I'm going with is Gtk-Perl. At first I had difficulty installing it, but in the end I found Camelbox Perl+Gtk2 in one package.

answered 2009-04-03T03:20:26.037
0

I have used Tk, but in the last few days I have been playing around with Continuity (CPAN entry), a stateful (persistent state per user) web application/server, and it could easily be a way to add "GUI" features into an application, while making it multi-user and portable at the same time.

Edit: At the time I wrote this, I was most interested in the fact that Continuity had its own built-in webserver. This is now true of other webframeworks for Perl as well. I have been using Mojolicious though I hear good things about Dancer too.

answered 2011-01-20T15:58:52.370

Your Answer