NAME
Tk::Sugar - Sugar syntax for Tk
VERSION
version 1.093180
SYNOPSIS
use Tk::Sugar;
$widget->pack( top, xfill2, pad20 );
# equivalent to those pack options:
# -side => 'top'
# -expand => 1
# -fill => 'both'
# -padx => 20
# -pady => 20
$widget->configure( enabled );
# equivalent to: -state => 'enabled'
DESCRIPTION
Tk is a great graphical toolkit to write desktop applications. However, one can get bothered with the constant typing of quotes and options. Tk::Sugar provides handy subs for common options used when programming Tk.
Benefits are obvious:
Reduced typing.
The constant need to type
=>
and''
is fine for one-off cases, but the instant you start using Tk it starts to get annoying.More compact statements.
Reduces much of the redundant typing in most cases, which makes your life easier, and makes it take up less visual space, which makes it faster to read.
No string worries.
Strings are often problematic, since they aren't checked at compile- time. Sometimes it makes spotting an error a difficult task. Using this alleviates that worry.
EXPORTS
This module is using Sub::Exporter underneath, so you can use all its shenanigans to change the export names.
Exported subs
Look below for the list of available subs.
Pack options
Traditional packer sides (available as :side
export group):
top - equivalent to
( -side => 'top' )
bottom - ditto
left - ditto
right - ditto
Packer expand and filling (available as :fill
export group):
fillx - equivalent to
( -fill => 'x' )
filly - equivalent to
( -fill => 'y' )
fill2 - equivalent to
( -fill => 'both' )
xfillx - same as
fillx
with( -expand => 1 )
xfilly - ditto for
filly
xfill2 - ditto for
fill2
Export groups
Beside the individual groups outlined above, the following export groups exist for your convenience:
- :default
-
This exports all existing subs.
- :pack
-
This exports all subs related to Tk::pack options. Same as
:side
and:fill
.
SEE ALSO
You can look for information on this module at:
Search CPAN
Open / report bugs
Git repository
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
AUTHOR
Jerome Quelin
COPYRIGHT AND LICENSE
This software is copyright (c) 2009 by Jerome Quelin.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.