Terrapin Resources

Turtles (TURTLE)

This page describes the properties that the TURTLE widget offers in addition to the WIDGET and BITMAP properties.

The following commands are also implemented as callable properties so you can ASK a turtle to perform the command:

PENDOWN, PENUP, PENERASE, PENREVERSE, PEN, SETPEN, PENDOWN?, PATTERN, SETPATTERN, PENCOLOR, SETPC, WIDTH,SETWIDTH, DOT, DOT?, DOTCOLOR, FILL, STAMPOVAL, STAMPRECT, TURTLETEXT, ALPHA, and SETALPHA.

ALPHA

Controls the transparency of the colors the turtle uses to draw.

Description

ALPHA gets or sets the alpha value that the turtle uses to draw with colors that do not have a specific alpha value, like color names, color indexes, or color lists with only three elements. When drawing, the turtle adds this value to any three-element color. A value of 1 makes the color opaque, and a value of 0 makes it completely transparent (invisible).

Example

SETPC “YELLOW (STAMPOVAL 100 100 TRUE) PPROP 0 “ALPHA 0.5 SETPC “RED (STAMPRECT 100 100 TRUE)

PATTERN

Reports or sets the current fill pattern.

Description

PATTERN contains the pattern that a turtle uses to fill shapes. This may be a value, an 8-element list, or the name of a bitmap whose black-and-white representation is used to fill an area. See the SETPATTERN command for details. Note that the FILL command does not use patterns, only solid colors.

Example

SETPATTERN 1 (STAMPRECT 100 100 TRUE)

PENCOLOR

Contains the current pen color.

Description

PENCOLOR contains the current pen color as a four–element list.

Example

GPROP 0 “PENCOLOR Result: [0 0 0 1]

PENSTATE

Controls the turtle’s pen state.

Description

PENSTATE controls the state of the turtle pen, one of the words PENDOWN, PENUP, PENERASE, or PENREVERSE.

Example

GPROP 0 “PENSTATE Result: PENDOWN

PENWIDTH

Gets or sets the turtle’s pen width.

Description

PENWIDTH gets or sets the size of the turtle pen in pixels.

Example

GPROP 0 “PENWIDTH Result: 1

SHAPE

Gets or sets the turtle’s shape.

Description

The turtle’s shape is the name of another object (usually a bitmap or a bitmap file) that is used to represent the turtle. Setting the SHAPE property to the empty word sets the standard turtle shape.

If the LOADSHAPE command loaded the shape, the property value is the name of the file what was loaded. The widget with that name does not need to exist.

Example

GPROP 0 “SHAPE Result: