Gstripes is a normal Runtime Library based template with only five properties:

There is, of course, also the -creator property. Creator has no meaning for Gstripes. Hence don’t change the creator to toplevel!


Do not change the value of »touch«!

»touch« is like »-creator« a static property. Set to off »0« touch disables almost every functionality described herein Chapter 6, Gstripes .

The purpose of »touch«, set to off, is to generate a print preview from a dialog, inside of another window –inside of an alien window hierarchy.

Example 6.1. A »stripesCommand«

# Tell the stripes window to use
# screen size static gstripes-stripes:
option add *Gstripes.fullscreen 1
proc teststripes {stripes canvas} {
    rtl::debug stdout "teststripes called"

    $canvas create prect \
       60 341 375 440 \
         -fill cornsilk2     -rx 10 \
       -stroke red2 -strokewidth 2.0 \
  -fillopacity 0.5

    # See »fullscreen«! ... and reuse
    # the original stripes, too.
    gstripes::stripes $stripes $canvas

There are additional properties inside the Option Database, controlling the Gstripes colours.

Controlling Gstripes

stripesColor, stripesWidth, fraction

»stripesWidth« and »stripesColor« do control the appearance, of standard stripes, whenever plain Tcl/Tk is used.

The standard »stripesColor« is 2% lighter than the »background« colour. This »fraction« can be defined through the Option Database. »fraction« is an integer value relating to the »background« colour. Standard for »fraction« is »102«, which translates to: 102% of the »background« colour. Similar »fraction 98« is 2 percent darker than the background.

tk::darken is used in calculate stripesColor from fraction and background.

stripesColor and background are opaque colours. Items lowered under »stripes« or »gstripes« will be partly obscured by the stripes. TkPath is required for transparent effects, as shown inside this book.

stripesTransparentColor, stripesWidth, stripesOpacity

These three Option Database properties are used, when TkPath is available. The default transparent colour is set to »white« with a opacity of »0.5« (50% transparent). »stripesWidth« has the same meaning as with plain Tcl/Tk. See also Controlling Gstripes for plain Tcl/Tk.

Seldom may the need arise to modify the stripes colour. Semi-transparent stripes just lightens the normal »background« of a Gstripes window.

Example 6.2. Using Gstripes

option add *StripesSample*background seagreen
toplevel .toplevel -title Dialog \
                   -class StripesSample

# Stripes uses the same background
# as .toplevel does.
place [gstripes::gstripes .toplevel.stripes] \
        -relwidth 1 \
       -relheight 1 \
      -bordermode ignore

pack [frame .toplevel.frame \
           -relief sunken \
       -background red3] \
            -ipadx 100 -ipady 100 \
             -padx 20   -pady 20

That was it?

Not yet! A textured background is nice to have, but not that exciting! The controls placed over the texture must either themselves being textured or better feature a transparent background.