Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are good interactive GUI builder packages for Perl?

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.

like image 688
mmccoo Avatar asked Mar 30 '09 00:03

mmccoo


2 Answers

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;
like image 139
Chas. Owens Avatar answered Oct 12 '22 09:10

Chas. Owens


Try wxPerl!

From the web site:

wxPerl is an extension module allowing the creation of GUI (Graphical User Interface) from Perl; it is built as a wrapper for the awesome wxWidgets C++ GUI toolkit.

like image 40
Frank Avatar answered Oct 12 '22 11:10

Frank