Class GRectangle

This class represents a solid rectangle to draw on the screen. It is a subclass of GObject, and inherits all of its attributes and methods.

Constructor

GRectangle(**keywords)

Constructor: Creates a new solid rectangle

To use the constructor for this class, you should provide it with a list of keyword arguments that initialize various attributes. The keywords are the same as the attribute names. For example, to create a red square centered at (0,0), use the constructor call

GRectangle(x=0,y=0,width=10,height=10,fillcolor=colormodel.RED)

This class supports the all same attributes as GObject plus the additional keyword linewidth. This attribute controls the width of the border around the rectangle. The attribute linecolor gives the color of this border, while fillcolor is the interior (fill) color.

As with GObject, the attributes x and y refer to the center of the rectangle. This is so that when you rotate the rectangle, it spins about the center.

Parameter:keywords – dictionary of keyword arguments

Precondition: See above.

Attributes

This class has all of the attributes of GObject. In addition, it has the following new attributes.

linewidth

The width of the exterior line of this shape.

Setting this to 0 means that the rectangle has no border.

Invariant: Must be an int or float >= 0.

Methods

This class does not have any methods beyond those defined in GObject.