Class GImage

class graphics.GImage(**keywords)

Instance represents a rectangular image in the GameView

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 attribute pos and whose width and height are defined by the attribute size. If the size attribute does not agree with the actual size of the image, the image is scaled to fit.

Constructor: creates a new 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, to create an image from the file “gollum.png”, use the constructor call

GImage(source=’gollum.png’)

This class supports the same keywords as GObject. In addition, it supports the keyword source for the attribute of the same name.

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