Choosing a Perl GUI Module for maximum cross platform usage
I'm working on a couple of personal project to improve my Perl skills. Among other things they need to provide a GUI interface on different OSes. In the past what little GUI work I did on Perl used TK (and that 开发者_开发百科was just working through some sample projects). I know that beyond TK, Qt and GTK are also options.
Are there others?
Among the available options, what do you recommend for this purpose. Right now I'm leaning towards GTK as an Ubuntu user but I'm wondering if Qt might not be a better choice for cross platform work with Windows.
I would suggest Wx
. It is a meta-toolkit designed for cross platform usage and will use whatever underlying toolkit is available on your target platform.
I've been writing the module XUL::Gui which uses Firefox or XULRunner to render its gui. Both of those are cross platform (and use native styling). Gui's are constructed using a functional form of the XUL and HTML markup languages with CSS styling. The module is still in development, but may be complete enough for your needs. Here is a short example:
use XUL::Gui;
display Window title => 'my window',
H2('event handling example:'),
Button(
label => 'click me',
oncommand => sub {
my ($self, $event) = @_;
$self->label = 'ouch!';
}
);
The module itself is pure Perl, and has only core module dependencies, making it easy to install (unlike nearly all the other gui toolkits for Perl which require C code compilation).
For maximum cross platform support, you can also use XUL::Gui
's alter ego Web::Gui which removes the Mozilla specific XUL support, but opens the door to rendering an HTML + CSS gui with most modern web browsers.
精彩评论