Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Perl/TK: how to set defaults for the whole script?

by choroba (Chancellor)
on Oct 24, 2012 at 07:43 UTC ( #1000563=note: print w/replies, xml ) Need Help??


in reply to Perl/TK: how to set defaults for the whole script?

You do not have to type the whole thing every time, just keep it in a variable:
my %Scale_defaults = ( -width => 10, -length => 200, -sliderlength => 16, -orient => 'horizontal', -borderwidth => 1, -cursor => 'hand2', -showvalue => 0 ); # ... my $s = $mainwindow->Scale(%Scale_defaults, -showvalue => 1); # override a default
If even this is not enough, you can subclass Scale and instantiate objects of the new class instead.
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Perl/TK: how to set defaults for the whole script?
by perltux (Scribe) on Oct 24, 2012 at 09:08 UTC
    Thanks, that sounds like a good solution to me!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1000563]
help
Chatterbox?
[SuicideJunkie]: Parse a serial number from a register. But it is humans that type it in originally.
[SuicideJunkie]: No respect for buffer sizes... give them a byte, they take three :D

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2016-12-07 22:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (131 votes). Check out past polls.