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

class GRectangle(**keywords)

A class representing a (potentially) solid rectangle.

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.

The interior (fill) color of this rectangle is fillcolor. If this value is None, then the rectangle is not solid. The color linecolor is the color of the border.

The only new property for this class is linewidth, which controls the width of the border around the rectangle. For all other properties, see the documentation for GObject.

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. 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='red')

This class supports the all same keywords as GObject plus the additional keyword linewidth.

Parameters:

keywords (keys are attribute names) – dictionary of keyword arguments

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: Value must be an int or float >= 0.

Methods

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