Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I've never used any gui with perl.... what's the easiest place to start if I need to make a simple stdin from user in GUI format. Example would be asking user for column numbers or other variable parameter in a simple pop up window rather than in bash. What would you recommend? Thanks so much !!! <\p>

Replies are listed 'Best First'.
Re: Easiest Simple GUI for standard input
by atcroft (Abbot) on Nov 30, 2016 at 03:58 UTC

    I think you will find that "easiest" will depend on the system you are on, but I would begin by looking at the "User Interfaces" section of Tutorials, which includes tutorials for Tk, Gtk, and wxPerl.

    Hope that helps.

      Maybe consider https://metacpan.org/pod/distribution/IUP/lib/IUP.pod#GetParam

      Like:

      perl -MIUP -E '($status, $val) = IUP->GetParam("Title", undef, "String: %s\n", "test"); say $val'
      
Re: Easiest Simple GUI for standard input
by Discipulus (Canon) on Nov 30, 2016 at 08:01 UTC
    Hello,

    Tk is almast simple when you have understood basic mechanics.

    It can run on very different OS and here around is full of examples and even books.

    It seems weird to me mixing a cli application with some gui part: in this case use a command line interface like the yet suggested Ask or doing it by hand reading from STDIN

    A full Tk application asking the user for some parameter can look like:

    use strict; use warnings; use Tk; my $param = ''; my $mw = Tk::MainWindow->new; $mw->Label(-text=>'Please enter your parameter:')->pack; $mw->Entry(-textvariable=>\$param)->pack; $mw->Button(-text=>'Submit (even if no button are needed', -command=>sub{ print "Button was pressed: \$param is now '$param'\n"; })->pack; MainLoop();

    Please note that $param is modified while typing in the Entry not when you hit the Submit button.

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: Easiest Simple GUI for standard input
by hippo (Archbishop) on Nov 30, 2016 at 08:18 UTC

    Curses is arguably the simplest GUI and there are a number of modules available to interface with it.

    There is Curses which offers a simple procedural interface and is a very long-standing module. You'll find lots of sample scripts for this on the web, but some will be very old.

    For OO there's Curses::UI, but that hasn't seen an update in 5 years and has quite a few outstanding issues.

    Plus others I haven't looked at: Curses::Application, Curses::Simp, etc.

Re: Easiest Simple GUI for standard input
by BrowserUk (Patriarch) on Nov 30, 2016 at 04:11 UTC
    I need to make a simple stdin from user in GUI format...

    Do you need a Gui? Or would a Cui suffice?

    Also: What OS? Or do you need OS agnostic? (If so, explain why?)


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Easiest Simple GUI for standard input
by Anonymous Monk on Nov 30, 2016 at 06:39 UTC