Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Verbose Tk Code

by tybalt89 (Monsignor)
on Feb 28, 2021 at 20:47 UTC ( [id://11128917]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Verbose Tk Code
in thread Verbose Tk Code

I've lately been doing things like this

$mw->Button(-text => $_->[0], -command => $_->[1], -font => 24, )->pack( -side => 'left', -fill => 'x', -expand => 1) for [Restart => \&restart], ['Previous State' => \&previous], ['Random Move' => \&random], [Help => \&help], [Exit => sub {$mw->destroy}];

which is a section from my chess player on RosettaCode https://rosettacode.org/wiki/Chess_player#Perl and I probably would do the same kind of thing for those five Labels.

One might consider for to be a perl approximation of with :)

Replies are listed 'Best First'.
Re^4: Verbose Tk Code
by LanX (Saint) on Feb 28, 2021 at 20:52 UTC
    Thanks

    > One might consider for to be a perl approximation of with :)

    yep, I was also thinking of offering a $_ default

    with { meth1(); meth2(); ... } for @objects;

    Tho your example didn't alias the objects but the attributes.

    But Tk might not be the best use case here, Choroba privately suggested to look at XML::LibXML .

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-24 10:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found