Class GLine

game2d.GLine(**keywords)

Instances represent a sequence of line segments

The line is defined by the points attribute which is an (even) sequence of alternating x and y values. When drawn in a GView object, the line starts from one x-y pair in points and goes to the next x-y pair. If points has length 2n, then the result is n-1 line segments.

The object uses the attribute linecolor to determine the color of the line. The attribute fillcolor is unused (even though it is inherited from GObject).

Constructor: creates a new sequence of line segments.

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 line from (0,0) to (2,3), use the constructor call

GLine(points=[0,0,2,3])

This class supports the same keywords as GObject, though many of them are unused, as the position and size attributes are now all immutable. Position and size are computed from the list of points. Therefore point and linecolor are the two primary keywords used by this constructor.

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 line.

Invariant: Must be a sequence (list or tuple) of int or float. The length of this sequence must be even with length at least 4.

fillcolor

This attribute is ignored.

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 GObject

Next topic

Class GTriangle

This Page