App::CPAN2Pkg::Tk::Utils - Tk utilities for gui building


App-CPAN2Pkg documentation Contained in the App-CPAN2Pkg distribution.

Index


Code Index:

NAME

Top

App::CPAN2Pkg::Tk::Utils - Tk utilities for gui building

VERSION

Top

version 2.111781

DESCRIPTION

Top

This module exports some useful subs for tk guis.

METHODS

Top

image

    my $img = image( $path [, $toplevel ] );

Return a tk image loaded from $path. If the photo has already been loaded, return a handle on it. If $toplevel is given, it is used as base window to load the image.

AUTHOR

Top

Jerome Quelin <jquelin@gmail.com>

COPYRIGHT AND LICENSE

Top


App-CPAN2Pkg documentation Contained in the App-CPAN2Pkg distribution.

#
# This file is part of App-CPAN2Pkg
#
# 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.
#
use 5.010;
use strict;
use warnings;

package App::CPAN2Pkg::Tk::Utils;
BEGIN {
  $App::CPAN2Pkg::Tk::Utils::VERSION = '2.111781';
}
# ABSTRACT: Tk utilities for gui building

use Exporter::Lite;
use POE;

use App::CPAN2Pkg::Utils qw{ $SHAREDIR };

our @EXPORT = qw{ image };


# -- public subs


sub image {
    my ($path, $toplevel) = @_;
    $toplevel //= $poe_main_window;
    my $img = $poe_main_window->Photo($path);
    return $img if $img->width;
    return $toplevel->Photo("$toplevel-$path", -file=>$path);
}


1;



__END__