Class GTriangle

game2d.GTriangle(**keywords)

Instances represent a solid triangle.

The triangle is defined sequence of three point. Just as with the GLine class (which is the parent of this class), it has an attribute point which represents this points as an even-length sequence of ints or floats.

The interior (fill) color of this rectangle is fillcolor, while linecolor is the color of the border.

Constructor: creates a new solid triangle.

param keywords:dictionary of keyword arguments

Precondition: See below.

To use the constructor for this class, you should provide it with a list of keyword arguments that initialize various attributes. For example, to create a red triangle with vertices (0,0), (2,3), and (0,4), use the constructor call

GTriangle(points=[0,0,2,3,0,4],fillcolor=colormodel.RED)

As with GLine the position and size attributes of this class are all immutable. They are computed from the list of points.

This class is a subclass of GObject, and inherits all of its attributes and methods.

Attributes

These attributes are in addition to those from GObject.

points

The sequence of points that make up this triangle.

Invariant: Must be a sequence (list or tuple) of int or float. The length of this sequence must be 6 (for 3 points).

height

This attribute is computed automatically from the attribute points

width

This attribute is computed automatically from the attribute points

x

This attribute is computed automatically from the attribute points

y

This attribute is computed automatically from the attribute points

Table Of Contents

Previous topic

Class GLine

Next topic

Class GPolygon

This Page