Class GImage

game2d.GImage(**keywords)

Instance represents a rectangular image.

The image is given by a JPEG, PNG, or GIF file whose name is stored in the attribute source. Image files should be stored in the Images directory so that Kivy can find them without the complete path name.

In this graphics object, the linecolor and fillcolor attributes are ignored. The image is displayed as a rectangle whose bottom left corner is defined by the attributes x and y. If the attributes width and height do not agree with the actual size of the image, the image is scaled to fit.

If the image supports transparency, then this object can be used to represent irregular shapes. However, the contains method still treats this shape as a rectangle.

Constructor: creates a new rectangle image

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, load the image beach-ball.png, use the constructor

GImage(x=0,y=0,width=10,height=10,source=’beach-ball.png’)

This class supports the all same keywords as GRectangle, though the color keywords are ignored.

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.

source

File name of a source file for this image.

Invariant: Must be a string or None. Default is None.
fillcolor

This attribute is ignored.

linecolor

This attribute is ignored.

Table Of Contents

Previous topic

Class GEllipse

Next topic

Class GLabel

This Page