File: class-gtkobject.html

package info (click to toggle)
python-gtk2-doc 2.5.2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,304 kB
  • ctags: 3,741
  • sloc: makefile: 38
file content (89 lines) | stat: -rw-r--r-- 22,590 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.Object</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gtk-class-reference.html" title="The gtk Class Reference"><link rel="previous" href="class-gtknotebook.html" title="gtk.Notebook"><link rel="next" href="class-gtkoptionmenu.html" title="gtk.OptionMenu"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gtk.Object</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtknotebook.html">Prev</a></td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-gtkoptionmenu.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtkobject"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.Object</h2><p>gtk.Object &#8212; the base class of the PyGTK type hierarchy.</p></div><div class="refsect1" lang="en"><a name="id3477043"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.Object</span></span>(<span class="ooclass"><span class="classname"><a href="class-gobject.html" title="gobject.GObject">gobject.GObject</a></span></span>):
<code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkobject.html#method-gtkobject--flags" title="gtk.Object.flags">flags</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkobject.html#method-gtkobject--set-flags" title="gtk.Object.set_flags">set_flags</a></span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>flags</tt></i></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkobject.html#method-gtkobject--unset-flags" title="gtk.Object.unset_flags">unset_flags</a></span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>flags</tt></i></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkobject.html#method-gtkobject--destroy" title="gtk.Object.destroy">destroy</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
<span class="bold"><b>Functions</b></span>

<code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkobject.html#function-gtk--bindings-activate" title="gtk.bindings_activate">gtk.bindings_activate</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>object</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>modifiers</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkobject.html#function-gtk--bindings-activate-event" title="gtk.bindings_activate_event">gtk.bindings_activate_event</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>object</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>event</tt></b></span></span>)</code></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3477207"></a><h2>Ancestry</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="synopsis">+-- <a href="class-gobject.html" title="gobject.GObject">gobject.GObject</a>
  +-- <a href="class-gtkobject.html" title="gtk.Object">gtk.Object</a>
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3477230"></a><h2>Signal Prototypes</h2><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term">"<a href="class-gtkobject.html#signal-gtkobject--destroy" title='The "destroy" gtk.Object Signal'>destroy</a>"</span></td><td><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>object</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></td></tr></tbody></table></div><div class="refsect1" lang="en"><a name="id3477287"></a><h2>Description</h2><p><a href="class-gtkobject.html" title="gtk.Object"><tt class="classname">gtk.Object</tt></a> is the
base class for all widgets, and for a few non-widget objects such as <a href="class-gtkadjustment.html" title="gtk.Adjustment"><tt class="classname">gtk.Adjustment</tt></a>.
<a href="class-gtkobject.html" title="gtk.Object"><tt class="classname">gtk.Object</tt></a>
predates <a href="class-gobject.html" title="gobject.GObject"><tt class="classname">GObject</tt></a>; non-widgets
that derive from <a href="class-gtkobject.html" title="gtk.Object"><tt class="classname">gtk.Object</tt></a> rather
than <a href="class-gobject.html" title="gobject.GObject"><tt class="classname">GObject</tt></a> do
so for backward compatibility reasons.</p><p>The "destroy" signal, emitted by the <a href="class-gtkobject.html#method-gtkobject--destroy" title="gtk.Object.destroy"><tt class="methodname">destroy</tt>()</a> 
method asks all code owning a GTK reference to the object to release its GTK
reference. So, for example, if you call
<tt class="methodname">window.destroy</tt>() where
<i class="parameter"><tt>window</tt></i> is a <a href="class-gtkwindow.html" title="gtk.Window"><tt class="classname">gtk.Window</tt></a>, GTK will
release the GTK reference count that it owns; if you call
<tt class="methodname">button.destroy</tt>() where button is a <a href="class-gtkbutton.html" title="gtk.Button"><tt class="classname">gtk.Button</tt></a>,
<i class="parameter"><tt>button</tt></i> will be removed from its parent container and
the parent container will release its GTK reference to
<i class="parameter"><tt>button</tt></i>. Because these GTK references are released,
calling <a href="class-gtkobject.html#method-gtkobject--destroy" title="gtk.Object.destroy"><tt class="methodname">destroy</tt>()</a> 
should result in freeing all memory associated with an object (finalizing
it) if the GTK reference count reaches zero. However, in PyGTK the GTK
objects are wrapped in a Python object that has its own reference counting
mechanism. The <a href="class-gtkobject.html#method-gtkobject--destroy" title="gtk.Object.destroy"><tt class="methodname">destroy</tt>()</a> 
method does not affect the Python reference counts. The GTK object
associated with a Python object will not be released until the Python object
reference count reaches zero. Therefore, calling the <a href="class-gtkobject.html#method-gtkobject--destroy" title="gtk.Object.destroy"><tt class="methodname">destroy</tt>()</a> 
method will not result in the finalization of the GTK object until the
Python object is finalized. In the case mentioned above if a <a href="class-gtkbutton.html" title="gtk.Button"><tt class="classname">gtk.Button</tt></a> is
destroyed using the <a href="class-gtkobject.html#method-gtkobject--destroy" title="gtk.Object.destroy"><tt class="methodname">destroy</tt>()</a> 
method, it will be removed from its container and unmapped and unrealized
but it will not be finalized because the Python wrapper object will still
exist and hold a reference.</p></div><div class="refsect1" lang="en"><a name="id3477448"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtkobject--flags"></a><h3>gtk.Object.flags</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">flags</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the flags set for the
object</td></tr></tbody></table><p>The <tt class="methodname">flags</tt>() method returns the value of
the flags for the object. The flags returned will include both the <a href="class-gtkobject.html" title="gtk.Object"><tt class="classname">gtk.Object</tt></a> flags and
the <a href="class-gtkwidget.html" title="gtk.Widget"><tt class="classname">gtk.Widget</tt></a>
flags.</p><p>The <a href="class-gtkobject.html" title="gtk.Object"><tt class="classname">gtk.Object</tt></a> flags
are:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><tt class="literal">gtk.IN_DESTRUCTION</tt></span></td><td>the object is currently being destroyed.</td></tr><tr><td><span class="term"><tt class="literal">gtk.FLOATING</tt></span></td><td>the object is orphaned.</td></tr><tr><td><span class="term"><tt class="literal">gtk.RESERVED_1</tt></span></td><td>reserved for future use</td></tr><tr><td><span class="term"><tt class="literal">gtk.RESERVED_2</tt></span></td><td>reserved for future use</td></tr></tbody></table><p>The <a href="class-gtkwidget.html" title="gtk.Widget"><tt class="classname">gtk.Widget</tt></a> flags
are:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><tt class="literal">gtk.TOPLEVEL</tt></span></td><td>widgets without a real parent (e.g. <a href="class-gtkwindow.html" title="gtk.Window"><tt class="classname">gtk.Window</tt></a> and <a href="class-gtkmenu.html" title="gtk.Menu"><tt class="classname">gtk.Menu</tt></a>) have this
flag set throughout their lifetime. Toplevel widgets always contain their
own <a href="class-gdkwindow.html" title="gtk.gdk.Window"><tt class="classname">gtk.gdk.Window</tt></a>.</td></tr><tr><td><span class="term"><tt class="literal">gtk.NO_WINDOW</tt></span></td><td>a widget that does not provide its own <a href="class-gdkwindow.html" title="gtk.gdk.Window"><tt class="classname">gtk.gdk.Window</tt></a>.
Visible action (e.g. drawing) is performed on the parent's <a href="class-gdkwindow.html" title="gtk.gdk.Window"><tt class="classname">gtk.gdk.Window</tt></a>.</td></tr><tr><td><span class="term"><tt class="literal">gtk.REALIZED</tt></span></td><td>the widget has an associated <a href="class-gdkwindow.html" title="gtk.gdk.Window"><tt class="classname">gtk.gdk.Window</tt></a>.</td></tr><tr><td><span class="term"><tt class="literal">gtk.MAPPED</tt></span></td><td>the widget can be displayed on the screen.</td></tr><tr><td><span class="term"><tt class="literal">gtk.VISIBLE</tt></span></td><td>the widget will be mapped as soon as its parent is
mapped.</td></tr><tr><td><span class="term"><tt class="literal">gtk.SENSITIVE</tt></span></td><td>The sensitivity of a widget determines whether it will
receive certain events (e.g. button or key presses). One requirement for the
widget's sensitivity is to have this flag set.</td></tr><tr><td><span class="term"><tt class="literal">gtk.PARENT_SENSITIVE</tt></span></td><td>This is the second requirement for the widget's
sensitivity. Once a widget has <tt class="literal">gtk.SENSITIVE</tt> and
<tt class="literal">gtk.PARENT_SENSITIVE set</tt>, its state is effectively
sensitive.</td></tr><tr><td><span class="term"><tt class="literal">gtk.CAN_FOCUS</tt></span></td><td>the widget is able to handle focus grabs.</td></tr><tr><td><span class="term"><tt class="literal">gtk.HAS_FOCUS</tt></span></td><td>the widget has the focus - assumes that
<tt class="literal">gtk.CAN_FOCUS</tt> is set</td></tr><tr><td><span class="term"><tt class="literal">gtk.CAN_DEFAULT</tt></span></td><td>the widget is allowed to receive the default
action.</td></tr><tr><td><span class="term"><tt class="literal">gtk.HAS_DEFAULT</tt></span></td><td>the widget currently will receive the default
action.</td></tr><tr><td><span class="term"><tt class="literal">gtk.HAS_GRAB</tt></span></td><td>the widget is in the grab_widgets stack, and will be
the preferred one for receiving events.</td></tr><tr><td><span class="term"><tt class="literal">gtk.RC_STYLE</tt></span></td><td>the widgets style has been looked up through the RC
mechanism. It does not imply that the widget actually had a style defined
through the RC mechanism.</td></tr><tr><td><span class="term"><tt class="literal">gtk.COMPOSITE_CHILD</tt></span></td><td>the widget is a composite child of its
parent.</td></tr><tr><td><span class="term"><tt class="literal">gtk.NO_REPARENT</tt></span></td><td>unused</td></tr><tr><td><span class="term"><tt class="literal">gtk.APP_PAINTABLE</tt></span></td><td>set on widgets whose window the application directly
draws on, in order to keep GTK from overwriting the drawn stuff.</td></tr><tr><td><span class="term"><tt class="literal">gtk.RECEIVES_DEFAULT</tt></span></td><td>the widget when focused will receive the default action
and have <tt class="literal">gtk.HAS_DEFAULT</tt> set even if there is a different
widget set as default.</td></tr><tr><td><span class="term"><tt class="literal">gtk.DOUBLE_BUFFERED</tt></span></td><td>exposes done on the widget should be
double-buffered.</td></tr></tbody></table></div><div class="refsect2" lang="en"><a name="method-gtkobject--set-flags"></a><h3>gtk.Object.set_flags</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_flags</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>flags</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>flags</tt></b>:</span></td><td>the <a href="class-gtkobject.html" title="gtk.Object"><tt class="classname">gtk.Object</tt></a> and <a href="class-gtkwidget.html" title="gtk.Widget"><tt class="classname">gtk.Widget</tt></a> flags to
be set on this object</td></tr></tbody></table><p>The <tt class="methodname">set_flags</tt>() method sets the object
flags according to the value of <i class="parameter"><tt>flags</tt></i>. See <a href="class-gtkobject.html#method-gtkobject--flags" title="gtk.Object.flags"><tt class="methodname">flags</tt>()</a>
for a description of the <a href="class-gtkobject.html" title="gtk.Object"><tt class="classname">gtk.Object</tt></a> and <a href="class-gtkwidget.html" title="gtk.Widget"><tt class="classname">gtk.Widget</tt></a> flags
that can be set.</p></div><div class="refsect2" lang="en"><a name="method-gtkobject--unset-flags"></a><h3>gtk.Object.unset_flags</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">unset_flags</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>flags</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>flags</tt></b>:</span></td><td>the <a href="class-gtkobject.html" title="gtk.Object"><tt class="classname">gtk.Object</tt></a> and <a href="class-gtkwidget.html" title="gtk.Widget"><tt class="classname">gtk.Widget</tt></a> flags to
be unset on this object</td></tr></tbody></table><p>The <tt class="methodname">unset_flags</tt>() method unsets the
object flags according to the value of <i class="parameter"><tt>flags</tt></i>. See
<a href="class-gtkobject.html#method-gtkobject--flags" title="gtk.Object.flags"><tt class="methodname">flags</tt>()</a>
for a description of the <a href="class-gtkobject.html" title="gtk.Object"><tt class="classname">gtk.Object</tt></a> and <a href="class-gtkwidget.html" title="gtk.Widget"><tt class="classname">gtk.Widget</tt></a> flags
that can be unset.</p></div><div class="refsect2" lang="en"><a name="method-gtkobject--destroy"></a><h3>gtk.Object.destroy</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">destroy</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><p>The <tt class="methodname">destroy</tt>() method emits the
"destroy" signal notifying all reference holders that they should release
the <a href="class-gtkobject.html" title="gtk.Object"><tt class="classname">gtk.Object</tt></a>.</p></div></div><div class="refsect1" lang="en"><a name="id3478233"></a><h2>Functions</h2><div class="refsect2" lang="en"><a name="function-gtk--bindings-activate"></a><h3>gtk.bindings_activate</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">gtk.bindings_activate</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>object</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>modifiers</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>object</tt></b>:</span></td><td>the <a href="class-gtkobject.html" title="gtk.Object"><tt class="classname">gtk.Object</tt></a> to
activate the bindings on</td></tr><tr><td><span class="term"><b class="parameter"><tt>keyval</tt></b>:</span></td><td>a key value</td></tr><tr><td><span class="term"><b class="parameter"><tt>modifiers</tt></b>:</span></td><td>a modifier mask</td></tr><tr><td><span class="term"><b class="parameter"><tt></tt></b>:</span></td><td></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">TRUE</tt> if the binding could be
activated</td></tr></tbody></table><p>The <tt class="function">gtk.bindings_activate</tt>() function
activates the bindings associated with the <a href="class-gtkobject.html" title="gtk.Object"><tt class="classname">gtk.Object</tt></a> specified
by object with the key value specified by <i class="parameter"><tt>keyval</tt></i> and
the modifier mask specified by <i class="parameter"><tt>modifiers</tt></i>.</p></div><div class="refsect2" lang="en"><a name="function-gtk--bindings-activate-event"></a><h3>gtk.bindings_activate_event</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">gtk.bindings_activate_event</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>object</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>event</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>object</tt></b>:</span></td><td>the <a href="class-gtkobject.html" title="gtk.Object"><tt class="classname">gtk.Object</tt></a> to
activate the bindings on</td></tr><tr><td><span class="term"><b class="parameter"><tt>event</tt></b>:</span></td><td>a <a href="class-gdkevent.html" title="gtk.gdk.Event"><tt class="classname">gtk.gdk.Event</tt></a></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">TRUE</tt> if a matching key
	  binding was found</td></tr></tbody></table><p>The <tt class="function">gtk.bindings_activate_event</tt>() function
looks up key bindings for the <a href="class-gtkobject.html" title="gtk.Object"><tt class="classname">gtk.Object</tt></a> specified
by <i class="parameter"><tt>object</tt></i> to find one matching the key <a href="class-gdkevent.html" title="gtk.gdk.Event"><tt class="classname">gtk.gdk.Event</tt></a>
specified by <i class="parameter"><tt>event</tt></i>, and if one was found, activate
it.</p></div></div><div class="refsect1" lang="en"><a name="id3478542"></a><h2>Signals</h2><div class="refsect2" lang="en"><a name="signal-gtkobject--destroy"></a><h3>The "destroy" gtk.Object Signal</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>object</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><i class="parameter"><tt>object</tt></i>:</span></td><td>the object that received the
signal</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_param1</tt></i>:</span></td><td>the first user parameter (if any) specified
with the <a href="class-gobject.html#method-gobject--connect" title="gobject.GObject.connect"><tt class="methodname">connect</tt>()</a>
method</td></tr><tr><td><span class="term"><i class="parameter"><tt>...</tt></i>:</span></td><td>additional user parameters (if
any)</td></tr></tbody></table><p>The "destroy" signal is emitted when the references for the
object should be destroyed.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-gtknotebook.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="gtk-class-reference.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="class-gtkoptionmenu.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.Notebook</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">gtk.OptionMenu</td></tr></table></div></body></html>