gobject.GObject3PyGTK Docsgobject.GObjectthe base classSynopsisgobject.GObjectget_propertyproperty_nameset_propertyproperty_namevaluefreeze_notifynotifyproperty_namethaw_notifyget_datakeyset_datakeydataconnectdetailed_signalhandlerconnect_afterdetailed_signalhandlerconnect_objectdetailed_signalhandlerconnect_object_afterdetailed_signalhandlerdisconnecthandler_idhandler_disconnecthandler_idhandler_is_connectedhandler_idhandler_blockhandler_idhandler_unblockhandler_idemitdetailed_signalstop_emissiondetailed_signalemit_stop_by_namedetailed_signalchainAncestry+-- gobject.GObject
Attributes
"__doc__"ReadThe documentation for the object type. Uses
"__gdoc__" if no specific documentation set."__gdoc__"ReadThe generated documentation for the underlying GObject
type."__gtype__"ReadThe underlying GObject type."__grefcount__"ReadThe reference count for the underlying GObject.
gobject.GObject Signal Prototypes"notify"callbackgobjectproperty_specuser_param1...DescriptionThe gobject.GObject
class is the base class providing the common attributes and methods for
the PyGTK classes. The gobject.GObject
class is not a user interface widget class.The gobject.GObject
class provides the signal management methods, the object property access
methods and the object data management methods.Methodsgobject.GObject.get_propertyget_propertyproperty_nameproperty_name :a string containing the property name for the
GObjectReturns :a Python object containing the value of the
propertyThe get_property() method returns the
value of the property specified by property_name or
None if there is no value associated with the property.The TypeError exception is raised
if the property name is not registered with the object class.gobject.GObject.set_propertyset_propertyproperty_namevalueproperty_name :a string containing the property
namevalue :a Python object containing the property value
to be setThe set_property() method sets the
property specified by property_name to the specified
value.The TypeError exception is raised
if the property name is not registered with the object class or if the value
specified could not be converted to the property type.gobject.GObject.freeze_notifyfreeze_notifyThe freeze_notify() method freezes the
object's property-changed notification queue so that "notify" signals are
blocked until the thaw_notify() method is
called.gobject.GObject.notifynotifyproperty_nameproperty_name :a string containing a property
nameThe notify() method causes the "notify"
signal for the property specified by property_name to
be emitted.gobject.GObject.thaw_notifythaw_notifyThe thaw_notify() method thaws the
object's property-changed notification queue so that "notify" signals are
emitted.gobject.GObject.get_dataget_datakeykey :a string used as the keyReturns :a Python object containing the associated
dataThe get_data() method returns the
Python object associated with the specified key or
None if there is no data associated with the key or
if there is no key associated with the object.gobject.GObject.set_dataset_datakeydatakey :a string used as a keydata :a Python object that is the value to be
associated with the keyThe set_data() method associates the
specified Python object (data) with
key.gobject.GObject.connectconnectdetailed_signalhandler...detailed_signal :a string containing the signal
namehandler :a Python function or method
object.... :additional optional
parametersReturns :an integer identifierThe connect() method adds a function or
method (handler)to the end of the list of signal
handlers for the named detailed_signal but before the
default class signal handler. An optional set of parameters may be specified
after the handler parameter. These will all be passed
to the signal handler when invoked.For example if a function handler was connected to a signal
using:
handler_id = object.connect("signal_name", handler, arg1, arg2, arg3)
The handler should be defined as:
def handler(object, arg1, arg2, arg3):
A method handler connected to a signal using:
handler_id = object.connect("signal_name", self.handler, arg1, arg2)
requires an additional argument when defined:
def handler(self, object, arg1, arg2)
A TypeError exception is raised
if detailed_signal identifies a signal name that is
not associated with the object.gobject.GObject.connect_afterconnect_afterdetailed_signalhandler...detailed_signal :a string containing the signal
namehandler :a Python function or method
object... :additional optional
parametersReturns :an integer handler
identifierThe connect_after() method is similar
to the connect() method except that the
handler is added to the signal handler list after the
default class signal handler. Otherwise the details of
handler definition and invocation are the
same.gobject.GObject.connect_objectconnect_objectdetailed_signalhandlergobjectdetailed_signal :a string containing the signal
namehandler :a Python function or method
objectgobject :a GObjectReturns :an integer handler
identifierThe connect_object() method is the same
as the connect() method except that the
handler is invoked with the specified
gobject in place of the object invoking the
connect_object() method. For example, a call with a
function handler:
handler_id = object("signal_name", handler, gobject)
will cause the handler to be invoked
as:
handler(gobject)
Likewise a method handler will be invoked as:
self.handler(gobject)
This can be helpful in invoking PyGTK widget methods that
require no arguments except the widget itself (e.g.
widget.destroy()) by using the class method as the
handler. For example, a Button "clicked" signal can be set up to invoke the
Window destroy() method as:
handler_id = button.connect_object("clicked", Window.destroy, window)
When the button is clicked the handler is invoked as:
Window.destroy(window)
which is the same as:
window.destroy()
Additional arguments may be passed to the handler as with the
connect() method handler invocations.gobject.GObject.connect_object_afterconnect_object_afterdetailed_signalhandlerdetailed_signal :a string containing the signal
namehandler :a Python function or method
objectgobject :a GObjectReturns :an integer handler
identifierThe connect_object_after() method is
similar to the connect_object() method except that
the handler is added to the signal handler list after
the default class signal handler. Otherwise the details of
handler definition and invocation are the
same.gobject.GObject.disconnectdisconnecthandler_idhandler_id :an integer handler
identifierThe disconnect() method removes the
signal handler with the specified handler_id from the
list of signal handlers for the object.gobject.GObject.handler_disconnecthandler_disconnecthandler_idhandler_id :an integer handler
identifierThe handler_disconnect() method removes
the signal handler with the specified handler_id from
the list of signal handlers for the object.gobject.GObject.handler_is_connectedhandler_is_connectedhandler_idhandler_id :an integer handler
identifierReturns :True if the signal handler
is connected to the object.The handler_is_connected() method
returns True if the signal handler with the specified
handler_id is connected to the object.gobject.GObject.handler_blockhandler_blockhandler_idhandler_id :an integer handler
identifierThe handler_block() method blocks the
signal handler with the specified handler_id from
being invoked until it is unblocked.gobject.GObject.handler_unblockhandler_unblockhandler_idhandler_id :an integer handler
identifierThe handler_unblock() method unblocks
the signal handler with the specified handler_id
thereby allowing it to be invoked when the associated signal is
emitted.gobject.GObject.emitemitdetailed_signal...detailed_signal :a string containing the signal
name... :additional parametersReturns :a PyObject*The emit() method causes the object to
emit the signal specified by detailed_signal. The
additional parameters must match the number and type of the required signal
handler parameters. In most cases no additional parameters are needed. for
example:
button.emit("clicked")
is all that is required to emit the "clicked" signal for a
button. The most common case requiring additional parameters occurs when
emitting an event signal; for example:
button.emit("button_press_event", event)
gobject.GObject.stop_emissionstop_emissiondetailed_signaldetailed_signal :a string containing the signal
nameThe stop_emission() method stops the
current emission of the signal specified by
detailed_signal. Any signal handlers in the list
still to be run will not be invoked.gobject.GObject.emit_stop_by_nameemit_stop_by_namedetailed_signaldetailed_signal :a string containing the signal
nameThe emit_stop_by_name() method stops
the current emission of the signal specified by
detailed_signal. Any signal handlers in the list
still to be run will not be invoked.gobject.GObject.chainchain...... :additional parametersReturns :a Python objectThe chain() method calls the superclass signal handler.
Normally, when you override the default signal handler for a widget
you're subclassing, your handler will get called in place of the handler
set up by the superclass. If you want to call the superclass's handler,
too, you can use the chain() method to chain up.
For instance, a gtk.Button draws itself inside its default
"expose-event" signal handler. If you subclass gtk.Button and override
the default handler for the "expose-event" signal in your subclass, then
the gtk.Button's default "expose-event" signal handler will no longer
get called when the widget redraws (and so the widget would be blank
instead of a button). If you chain up with chain() then the gtk.Button
's default handler will get called and the button will get drawn.
SignalsThe GObject "notify" Signalcallbackgobjectproperty_specuser_param1...gobject :the gobject that received the
signalproperty_spec :the gobject.GParamSpec of the property that was
changeduser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)The "notify" signal is emitted on a gobject when one of its
properties has been changed. Note that getting this signal doesn't guarantee
that the value of the property has actually changed, it may also be emitted
when the setter for the property is called to reinstate the previous
value. For example to be notified of the change of the title of a gtk.Window you could
connect to the "notify" signal similar to:
window.connect("notify::title", callback)