GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TK::SUGAR (3)

.ds Aq ’

NAME

Tk::Sugar - Sugar syntax for Tk

CONTENTS

VERSION

version 1.093190

SYNOPSIS



    use Tk::Sugar qw{ :pack :state };

    $widget->pack( top, xfill2, pad10 );
    # equivalent to those pack options:
    #     -side   => top
    #     -expand => 1
    #     -fill   => both
    #     -padx   => 10
    #     -pady   => 10

    $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:
o 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.

o 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.

o 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):
o top - equivalent to ( -side => top )
o bottom - ditto for bottom
o left - ditto for left
o right - ditto for right
Packer expand and filling (available as :fill export group):
o fillx - equivalent to ( -fill => x )
o filly - equivalent to ( -fill => y )
o fill2 - equivalent to ( -fill => both )
o xfillx - same as fillx with ( -expand => 1 )
o xfilly - ditto for filly
o xfill2 - ditto for fill2
o expand - equivalent to ( -expand => 1 ) if you don’t like the xfill* notation
Packer padding (available as :pad export group):
o pad1 - equivalent to ( -padx => 1, -pady => 1 )
o pad2 - ditto with 2 pixels
o pad5 - ditto with 5 pixels
o pad10 - ditto with 10 pixels
o pad20 - ditto with 20 pixels
o pad($n) - ditto with $n pixels (function call with one argument)
o padx($n) - x padding with $n pixels (function call with one argument)
o pady($n) - y padding with $n pixels (function call with one argument)
Packer padding (available as :ipad export group):
o ipad1 - equivalent to ( -ipadx => 1, -ipady => 1 )
o ipad2 - ditto with 2 pixels
o ipad5 - ditto with 5 pixels
o ipad10 - ditto with 10 pixels
o ipad20 - ditto with 20 pixels
o ipad($n) - ditto with $n pixels (function call with one argument)
o ipadx($n) - internal x padding with $n pixels (function call with one argument)
o ipady($n) - internal y padding with $n pixels (function call with one argument)
Common options

Widget state (available as :state export group):
o enabled - equivalent to ( -state => normal )
o disabled - ditto for disabled
Widget anchor (available as :anchor export group). Note that those subs are upper case, otherwise the sub s would clash with the regex substitution:
o N - equivalent to ( -anchor => n )
o S - ditto with s
o E - ditto with e
o W - ditto with w
o C - ditto with center
o NE - ditto with ne
o NW - ditto with nw
o SE - ditto with se
o SW - ditto with sw
Widget orientation (available as :orient export group).:
o horizontal - equivalent to ( -orient => horizontal )
o vertical - ditto with vertical

    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 subs related to Tk::pack options. Same as :side, :fill, :pad and :ipad.
:options This exports subs related to widget configure options. Same as :state, :anchor and :orient.

SEE ALSO

You can look for information on this module at:
o Search CPAN

<http://search.cpan.org/dist/Tk-Sugar/>

o Open / report bugs

<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Tk-Sugar>

o Git repository

<http://github.com/jquelin/tk-sugar.git>

o AnnoCPAN: Annotated CPAN documentation

<http://annocpan.org/dist/Tk-Sugar>

o CPAN Ratings

<http://cpanratings.perl.org/d/Tk-Sugar>

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.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 TK::SUGAR (3) 2009-11-15

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.