++ed by:
CAC

1 PAUSE user

Author image Christopher Alexander Chavez

NAME

Tcl::pTk::Facelift - Update the look of older Tk scripts using the new tile widgets

SYNOPSIS

        # Run a existing tcl/tk script 'tcltkscript.pl' with an updated look
        perl -MTcl::pTk::Facelift tcltkscript.pl
        
        # Alternatively, you can just put 'use Tcl::pTk::Facelift' at the
        #  top of the 'tcltkscript.pl' file and just run it like normal

        # You can also do this in combination with Tcl::pTk::TkHijack to run
        #  an existing perl/tk script using Tcl::pTk and with an updated look
        #  
        perl -MTcl::pTk::TkHijack -MTcl::pTk::Facelift tkscript.pl

DESCRIPTION

Tcl::pTk::Facelift is an experimental module that gives existing tcl/tk scripts an updated look by substituting some the widgets (button, entry, label, etc) with their new "Tile" widget equivalents.

Note that this replacement/substitution is not complete. The new "Tile" widgets aren't 100% compatible with the older widgets. To take full advantage of the new Tcl/Tk "Tile" widgets, you should re-code your application to specifically take advantage of them.

This package only replaces some of the basic widgets (e.g. button, label, entry, etc) with their tile-widget equivalents.

How It Works

New widgets are created that override the creation-methods for the old widgets. These new methods create the new "Tile" widgets, instead of the old widgets.

For Example, this code snippet would create a top-level window, and a Label and Button widget

 use Tcl::pTk;
 my $mw     = MainWindow->new();
 my $label  = $mw->Label();
 my $button = $mw->Button();
 

Now, with the addition of the use Tcl::pTk::Facelift package, the Label and <Button> creation-methods get over-ridden to build "Tile" widgets.

 use Tcl::pTk;
 use Tcl::pTk::Facelift;
 my $mw     = MainWindow->new();
 my $label  = $mw->Label();
 my $button = $mw->Button();

Note: The new widgets created in this package have the same options as the old widget, but where there is no equivalent option in the new "Tile" widget, the option is ignored.

For example, most appearance-related options that are present in the old widgets don't exist in the new "Tile" widgets, because Tile-widgets appearances are controlled using "Themes". So the -bg (background color) option that exists for an old "button" widget doesn't exist in the new "ttkButton" widget. For better compatibility with existing scripts, the Tile-substitution widgets (e.g. the Button, Entry, etc widgets) created in this package will have a appearance options (e.g. -bg, -fg, etc) option, but they will be ignored.

Examples

There are some examples of using Facelift (along with TkHijack) with a simple perl/tk script, and a perl/tk mega-widget. See t/Facelift_simple.t and t/Facelift_mega.t in the source distribution.

LIMITATIONS

  • Substitutes for all the old widgets aren't provided

  • Options in the old widgets that aren't present the new Tile widgets are simply ignored.