\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#262: Background Images for Frames}
\date{March 18, 2006}
\author{Eric Taylor, Donal K. Fellows}
\urlstyle{sf}
\setlength{\parskip}{1ex}
\setlength{\parindent}{0pt}
\def\tipversion$#1${\texttt{\$#1\$}}
\def\tiplangle#1{\ensuremath{<}}
\def\tiprangle#1{\ensuremath{>}}
\def\tipbar#1{\ensuremath{|}}
\def\tipmail#1#2{\(\langle\){\small\expandafter\url{#1@#2}}\(\rangle\)}
\ifx\pdfoutput\undefined
\newcommand{\tipimage}[2]{\typeout{Make sure you download #1.eps}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.eps}}{\includegraphics[width=0.8\textwidth]{#1.eps}}}
\newcommand{\tipxref}[1]{}
\newcommand{\tipxrefend}{}
\else
\newcommand{\tipimage}[2]{\typeout{Make sure you create #1.pdf}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.pdf}}{\includegraphics[width=0.8\textwidth]{#1.pdf}}}
\pdfcatalog{/PageMode /UseOutlines}
\newcommand{\tipxref}[1]{\pdfannotlink attr {/C [0.5 0.5 1.0] /Border [0 0 1]} goto name {#1}}
\newcommand{\tipxrefend}{\pdfendlink}
\fi
\newenvironment{tipabstract}{\begin{abstract}}{\end{abstract}}
\begin{document}\maketitle
\begin{center}\begin{tabularx}{\linewidth}{|r@{: }X|}\hline
\textbf{TIP \#262}&\textbf{Background Images for Frames}\\\hline
Author&

Eric Taylor \tipmail{et2}{rocketship1.com}
\par
Donal K. Fellows \tipmail{donal.k.fellows}{manchester.ac.uk}
\\
Created&Saturday, \(\text{18}^{\text{th}}\) March 2006\\
Type&Project\\
Tcl Version&\(8.7\)\\
State&Draft\\
Vote&Pending\\
Version&\tipversion$Revision: 1.5 $\\
Keywords&Tk, option\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

This TIP proposes an option for frames that allows users to set the background of the window to be an image.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Rationale}

Just a there is an \textbf{-image} option for \textbf{button} widgets, this TIP suggests that a \textbf{-backgroundimage} option for frames be implemented. The image should be either an entire single image, or a smaller image that would be tiled, with a \textbf{-tile} option. Tiling would repeat, as needed, a smaller image to fit the visible area of the frame.

If the image was tiled, then it should be re-tiled as needed during a resize. The image would reside behind any other decoration or other widgets that resided in the frame. The image should be re-configurable to replace the image and/or remove it, as with a button image.

This TIP should allow some rather classy looking tcl/tk programs to be created with much ease.

\section{Proposed Change}

Two new options are proposed for \textbf{frame} widgets, to be manipulated using the normal \textbf{configure} and \textbf{cget} methods:
\begin{itemize}
\item{}
\textbf{-backgroundimage} \textit{imageName} --- This gives the name of an image (as created by \textbf{image create}) that is to be painted onto the widget immediately after the painting of the solid background colour. If \textit{imageName} is the empty string (the default) no image will be painted. The painting of the image will be controlled by the \textbf{-tile} option.
\item{}
\textbf{-tile} \textit{boolean} --- If this option gives \textit{boolean} as true, the image will be painted such that the top-left corner corresponds to the top-left corner of the frame, and then subsequently repeatedly painted (with no gaps between the areas painted) to the right and below that initial painting until such time as the entire widget is covered by copies of the image. If this option gives \textit{boolean} as false, the image will only be painted once, such that the center of the image painted is coincident with the center of the frame widget.
\end{itemize}

\section{Copyright}

This document has been placed in the public domain.

\section{Colophon}

\textit{TIP AutoGenerator --- written by Donal K. Fellows}
\end{document}
