Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a tool like PySimpleGUI for Perl?

I am looking for a Perl GUI tool that is as simple as PySimpleGUI. PySimpleGUI claims to be a good choice for things like this:

  • add the convenience of a simple GUI onto a CLI Perl script.
  • share some cool Perl tools I run from the terminal but give the (internal) users a simple GUI
  • share my Perl programs with friends or family (that aren't so comfortable with the CLI)
  • run a program in the system tray (potentially)
  • looking for a GUI package that is "supported" and is being constantly developed and improved
  • good documentation and examples

Those are my requirements and because PySimpleGUI offers all that, I gave it a try for a project. I liked it. That prompted to to try to find something like it for Perl.

I'm running perl 5, version 30 on Linux with KDE.

So far I only found:

  • saiftynet/GUIDeFATE: GUI Design From A Text Editor https://github.com/saiftynet/GUIDeFATE

I was not able to get the examples to run, and the supplied documentation doesn't meet my requirements. (I will ask about my specific problems with GUIDeFATE in a separate question, but GUIDeFATE is not actively developed like PySimpleGUI.)

I have used Kdialog for bash scripts in the past and it is not what I have in mind.

Is there an equivalent of PySimpleGUI for Perl?

like image 746
MountainX Avatar asked Oct 12 '25 20:10

MountainX


1 Answers

I was not able to find anything like PySimpleGUI in Perl. I think you need to build the gui based on the full api of the toolkit (and not a simplified version of the api like PySimpleGUI). I know that the Gtk3 and Tk toolkits are actively used. There are also the Wx and QtCore4 toolkits, but these are less used and not actively maintained in my opinion.

Here is an example in Gtk3:

use feature qw(say);
use strict;
use warnings;
use Gtk3 -init;

my $window = Gtk3::Window->new( 'toplevel' );
$window->signal_connect( destroy  => sub { Gtk3->main_quit() } );
my $grid = Gtk3::Grid->new();
$window->add( $grid );
my $label1 = Gtk3::Label->new('Some text on Row 1');
$grid->attach($label1, 0,0,1,1);
my $label2 = Gtk3::Label->new('Enter something on Row 2');
$grid->attach($label2, 0,1,1,1);
my $entry = Gtk3::Entry->new();
$grid->attach($entry, 1,1,1,1);
my $button1 = Gtk3::Button->new('Ok');
$button1->signal_connect('clicked' => sub { say "You entered ", $entry->get_text( ) } );
$grid->attach($button1, 0,2,1,1);
my $button2 = Gtk3::Button->new('Cancel');
$button2->signal_connect('clicked' => sub { $window->destroy() } );
$grid->attach($button2, 1,2,1,1);
$window->set_position('center_always');
$window->show_all();
Gtk3->main();
like image 86
Håkon Hægland Avatar answered Oct 15 '25 07:10

Håkon Hægland