Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Passing arguments for GUI development in Tk

by Athanasius (Archbishop)
on Sep 15, 2015 at 13:03 UTC ( [id://1142079]=note: print w/replies, xml ) Need Help??


in reply to Passing arguments for GUI development in Tk

Hello archana12, and welcome to the Monastery!

I don’t understand why you would want to pass the name of the Perl script to the GUI module? The other three options can just be handled in the normal way. For example, the following script combines example code from the synopses for Getopt::Long and Tk:

#! perl use strict; use warnings; use Getopt::Long; use Tk; my ($i, $d, $o); GetOptions ("i=s" => \$i, "d=s" => \$d, "o=i" => \$o) or die "Error in command line arguments: $!"; my $mw = MainWindow->new; $mw->Label(-text => "$i #$o")->pack; $mw->Button ( -text => $d, -command => sub { exit }, )->pack; MainLoop;

You could then call it like this (using wperl in place of perl to by-pass the console):

>wperl 1374_SoPW.pl -o 42 -i Title -d Quit

(If that doesn’t answer your question, please explain what you’re looking for in greater detail.)

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2024-04-23 08:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found