Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Easiest Simple GUI for standard input

by Discipulus (Canon)
on Nov 30, 2016 at 08:01 UTC ( [id://1176903]=note: print w/replies, xml ) Need Help??


in reply to Easiest Simple GUI for standard input

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1176903]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-25 11:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found