Perl 6 interface to the IUP toolkit for building GUI's.
Perl 6 interface to the IUP toolkit. IUP is a multi-platform toolkit for building graphical user interfaces. IUP's purpose is to allow a program source code to be compiled in different systems without any modification. Its main advantages are:
- it offers a simple API.
- high performance, due to the fact that it uses native interface elements.
- fast learning by the user, due to the simplicity of its API.
You will need the Linux libraries libiup
and libiupimglib
installed
in order to use perl6-IUP (version 3). You can download the library binaries
or sources for your platform from here.
To install with the Zef tool.
zef update
zef install IUP
To run a script that uses the IUP library.
PERL6LIB=$HOME/.perl6/2013.02.1/lib LD_LIBRARY_PATH=$HOME/.perl6/2013.02.1/lib ./hello.p6
WARNING: This module is Work in Progress and is in a early stage, which means:
this interface is not final. This will perhaps change in the future.
A sample of the code can be seen below.
use IUP;
my @argv = ("Test");
#
# initialize iup
#
my $iup = IUP.new();
$iup.image_lib_open();
$iup.open(@argv);
#
# create widgets and set their attributes
#
my $btn = $iup.button("&Ok", "");
$btn.set_callback("ACTION", &exit_callback);
$btn.set_attribute("IMAGE", "IUP_ActionOk");
$btn.set_attribute("EXPAND", "YES");
$btn.set_attribute("TIP", "Exit button");
my $lbl = $iup.label("Hello, world!");
my $vb = $iup.vbox($lbl, $btn);
$vb.set_attribute("MARGIN", "10x10");
$vb.set_attribute("GAP", "10");
$vb.set_attribute("ALIGNMENT", "ACENTER");
my $dlg = $iup.dialog($vb);
$dlg.set_attribute("TITLE", "Hello");
#
# Map widgets and show dialog
#
$dlg.show();
#
# Wait for user interaction
#
$iup.main_loop();
#
# Clean up
#
$dlg.destroy();
$iup.close();
exit();
sub exit_callback() returns Int {
return IUP_CLOSE;
}
Henrique Dias [email protected]
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.