IntroductionThis document describes most of the PyGTK version
2.0 through 2.24 classes and their methods and associated
functions. Deprecated classes, functions and methods have been
specifically left out of this reference though classes that have become
deprecated since PyGTK 2.0 have been left in but annotated with a
deprecation warning. This document attempts to document as much of the
PyGTKAPI as possible but there are
undoubtedly errors and omissions. If you discover any of these please file
a bug report at bugzilla.gnome.org for the
pygtk project. Specific areas that have not been
documented include:The Cairo classesThis reference describes the API for PyGTK as of
version 2.24. The differences in the API between version 2.24 and previous
versions are denoted in this reference with a Note that describes the
availability of the object, constructor, method or function. Any of these
that do not have a notation can be assumed to be available in all versions
of PyGTK from 2.0 and up. In the case of properties and signals the
availability is dependent on the version of the underlying GTK+, GDK or Pango
libraries. These will be annotated appropriately in a similar fashion. The
source code must be consulted if this reference and your version of
PyGTK seem to differ. You are encouraged to use the latest
version of PyGTK that is available. See the PyGTK homepage for
more information and more resources on how to use PyGTK as well as help in
its development. The Reference contains a chapter for each PyGTK
module (that corresponds to the underlying GTK+
library) containing the class descriptions. The second chapter illustrates
the PyGTK class hierarchy covering the gobject, gtk,
gtk.gdk and pango modules.The class descriptions are arranged alphabetically within the
chapters. Currently there are five module chapters:The atk moduleThe classes that are included in the
atk module of PyGTK and are
accessed similar to: atk.Object. These classes are the base object
classes that provide accessibility support for the
gtk module classes.The gtk moduleThe classes that are included in the
gtk module of PyGTK and are
accessed similar to: gtk.Widget. These classes are the "higher" level
widget classes that provide most of the user interface widgets used
for application development.The gtk.gdk moduleThe classes that are included in the
gtk.gdk module of PyGTK. These
classes are "lower" level classes that provide more fundamental
capabilities that the gtk module widgets are built
upon. These classes provide an abstract interface to the underlying
window system (either X Window System or Microsoft Windows).The gtk.glade moduleThe classes that are included in the
gtk.glade module of PyGTK. These
classes provide access to the libglade functions that allow the
dynamic loading of user interfaces from XML descriptions.The pango moduleThe classes that are included in the
pango module of PyGTK. These
classes provide access to the Pango text layout and rendering
engines. PyGTK supports a subset of the full Pango capability:
mainly the high level layout capabilities exposed by the
pango.Layout objects. The low level rendering capabilities have not
been exposed mostly because there isn't a full GObject interface to
the underlying Pango data structures. It's also likely that the
rendering capabilities require more performance that Python can
provide.The gobject module is documented in the PyGObject Reference Manual.Reference Page FormatEach PyGTK class is described in a reference
page that has a number of sections in a fixed format. Each reference page
will have a subset of the following sections:NameThe name and a one-line description of the
class.SynopsisA synopsis of the class and its methods and
optionally a list of associated functions.AncestryThe list of the parent classes of the class. This
section may not be present in all class descriptions.PropertiesA list of the properties (internal state)
supported by the class. This section may not be present in all classes. The
property descriptions include the name, the access operations (e.g. Read,
Write), and a brief description. Properties are accessed using the gobject.set_property()
and gobject.get_property()
methods that are available to every PyGTK object. This
section may not be present in all class descriptions.Style PropertiesA list of style properties supported by the
class. Similar to the properties (described above) the style properties hold
information about the style of a widgets e.g. border style, shadow type,
etc. Most widgets do not support style properties so this section is not
present in most class descriptions. Only PyGTK 2.4 has the ability to access
style properties.Child PropertiesA list of child properties supported by the
class. Similar to the properties (described above) the child properties hold
information about the properties of a widget's child widget. Only container
widgets support child properties so this section is not present in most
class descriptions.AttributesA set of internal object state data accessible as
Python attributes (e.g. object.attr). The attribute descriptions include a
name by which the attribute data is accessed, the access mode (e.g. Read,
Write), and a brief description of the attribute. Most
PyGTK classes do not support attributes so this section
is not present in most class descriptions.Signal PrototypesA list of the signals supported by the class
including the signal name and a synopsis of the signal handler function
prototype. This section may not be present in all class descriptions; most
gtk.gdk classes do not support signals.DescriptionA description of the class and possibly some of
the methods supported by the class.ConstructorThe description of the class object constructor
including the synopsis with brief parameter descriptions and a description
of th use of the constructor. There may be more than one constructor
description if the constructor supports different parameter lists. This
section may not be present in all class descriptions.MethodsA list of methods supported by the class. Each
method description includes: a synopsis of the method and its parameters as
well as a brief description of each parameter and return value (if any);
and, a description of the use of the method.FunctionsA list of related functions. Each function
description includes a synopsis of the function and its parameters and
return value (if any), and a description of the use of the
function.SignalsA list of signals including a synopsis of the
signal handler prototype function with its parameters and return value (if
any). The signal emission conditions are briefly described. This section is
not present in all class descriptions; specifically, the
gtk.gdk classes do not usually support signals.The function and method synopsis parameters are displayed in
bold to denote Python keyword parameters.
Also if the parameter is optional its default value will be displayed. For
example the gtk.Button()
constructor synopsis is:gtk.ButtonlabelNonestockNoneThe parameters label and
stock are keyword parameters that can be specified in
a call either by position or keyword (in which case position is not
important). The following calls have the same result:
b = gtk.Button("Cancel")
b = gtk.Button(label="Cancel")
b = gtk.Button("Cancel", None)
b = gtk.Button("Cancel", stock=None)
b = gtk.Button(stock=None, label="Cancel")
Parameters that are not keyword parameters are displayed in
italic and must be specified positionally but may
also be optional.