File: class-gtkimage.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 (249 lines) | stat: -rw-r--r-- 52,699 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.Image</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-gtkiconview.html" title="gtk.IconView"><link rel="next" href="class-gtkimagemenuitem.html" title="gtk.ImageMenuItem"></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.Image</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkiconview.html">Prev</a></td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-gtkimagemenuitem.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtkimage"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.Image</h2><p>gtk.Image &#8212; A widget displaying an image
</p></div><div class="refsect1" lang="en"><a name="id3442724"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.Image</span></span>(<span class="ooclass"><span class="classname"><a href="class-gtkmisc.html" title="gtk.Misc">gtk.Misc</a></span></span>):
<code class="constructorsynopsis">    <span class="methodname"><a href="class-gtkimage.html#constructor-gtkimage" title="Constructor">gtk.Image</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--set-from-pixmap" title="gtk.Image.set_from_pixmap">set_from_pixmap</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>pixmap</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>mask</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--set-from-image" title="gtk.Image.set_from_image">set_from_image</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>gdk_image</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>mask</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--set-from-file" title="gtk.Image.set_from_file">set_from_file</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>filename</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--set-from-pixbuf" title="gtk.Image.set_from_pixbuf">set_from_pixbuf</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>pixbuf</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--set-from-stock" title="gtk.Image.set_from_stock">set_from_stock</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>stock_id</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--set-from-icon-set" title="gtk.Image.set_from_icon_set">set_from_icon_set</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>icon_set</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--set-from-animation" title="gtk.Image.set_from_animation">set_from_animation</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>animation</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--get-storage-type" title="gtk.Image.get_storage_type">get_storage_type</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--get-pixmap" title="gtk.Image.get_pixmap">get_pixmap</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>pixmap</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>mask</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--get-image" title="gtk.Image.get_image">get_image</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>gdk_image</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>mask</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--get-pixbuf" title="gtk.Image.get_pixbuf">get_pixbuf</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--get-stock" title="gtk.Image.get_stock">get_stock</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>stock_id</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--get-icon-set" title="gtk.Image.get_icon_set">get_icon_set</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>icon_set</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--get-animation" title="gtk.Image.get_animation">get_animation</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--get-icon-name" title="gtk.Image.get_icon_name">get_icon_name</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--set-from-icon-name" title="gtk.Image.set_from_icon_name">set_from_icon_name</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>icon_name</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--set-pixel-size" title="gtk.Image.set_pixel_size">set_pixel_size</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>pixel_size</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#method-gtkimage--get-pixel-size" title="gtk.Image.get_pixel_size">get_pixel_size</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-gtkimage.html#function-gtk--image-new-from-stock" title="gtk.image_new_from_stock">gtk.image_new_from_stock</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>stock_id</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#function-gtk--image-new-from-icon-set" title="gtk.image_new_from_icon_set">gtk.image_new_from_icon_set</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>icon_set</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#function-gtk--image-new-from-animation" title="gtk.image_new_from_animation">gtk.image_new_from_animation</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>animation</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkimage.html#function-gtk--image-new-from-animation" title="gtk.image_new_from_animation">gtk.image_new_from_icon_name</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>icon_name</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</tt></b></span></span>)</code></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3443210"></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>
    +-- <a href="class-gtkwidget.html" title="gtk.Widget">gtk.Widget</a>
      +-- <a href="class-gtkmisc.html" title="gtk.Misc">gtk.Misc</a>
        +-- <a href="class-gtkimage.html" title="gtk.Image">gtk.Image</a>
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3443245"></a><h2>Properties</h2><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table width="100%" border="0"><colgroup><col><col><col></colgroup><tbody><tr valign="top"><td valign="top">"file"</td><td valign="top">Write</td><td valign="top">A filename containing the image data. Default value:
<tt class="literal">None</tt></td></tr><tr valign="top"><td valign="top">"icon-name"</td><td valign="top">Read-Write</td><td valign="top">The name of the icon in the icon theme. If the icon
theme is changed, the image will be updated automatically. Default value:
<tt class="literal">None</tt>. Available in GTK 2.6 and above.</td></tr><tr valign="top"><td valign="top">"icon-set"</td><td valign="top">Read-Write</td><td valign="top">the <a href="class-gtkiconset.html" title="gtk.IconSet"><tt class="classname">gtk.IconSet</tt></a> to
display</td></tr><tr valign="top"><td valign="top">"icon-size"</td><td valign="top">Read-Write</td><td valign="top">the size to use for a stock icon, named icon or icon
set. Allowed values: &gt;= 0. Default value: 4</td></tr><tr valign="top"><td valign="top">"image"</td><td valign="top">Read-Write</td><td valign="top">a <a href="class-gdkimage.html" title="gtk.gdk.Image"><tt class="classname">gtk.gdk.Image</tt></a> to
display</td></tr><tr valign="top"><td valign="top">"mask"</td><td valign="top">Read-Write</td><td valign="top">a bitmap <a href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><tt class="classname">gtk.gdk.Pixmap</tt></a> to
use with a <a href="class-gdkimage.html" title="gtk.gdk.Image"><tt class="classname">gtk.gdk.Image</tt></a> or a
<a href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><tt class="classname">gtk.gdk.Pixmap</tt></a></td></tr><tr valign="top"><td valign="top">"pixbuf"</td><td valign="top">Read-Write</td><td valign="top">the <a href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><tt class="classname">gtk.gdk.Pixbuf</tt></a> 
to display</td></tr><tr valign="top"><td valign="top">"pixbuf-animation"</td><td valign="top">Read-Write</td><td valign="top">the <a href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><tt class="classname">gtk.gdk.PixbufAnimation</tt></a> 
to display</td></tr><tr valign="top"><td valign="top">"pixel-size"</td><td valign="top">Read-Write</td><td valign="top">a fixed size overriding the "icon-size" property for
images of type <tt class="literal">gtk.IMAGE_ICON_NAME</tt>. Allowed values: &gt;=
-1. Default value: -1. Available in GTK+ 2.6 and above.</td></tr><tr valign="top"><td valign="top">"pixmap"</td><td valign="top">Read-Write</td><td valign="top">a <a href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><tt class="classname">gtk.gdk.Pixmap</tt></a> to
display</td></tr><tr valign="top"><td valign="top">"stock"</td><td valign="top">Read-Write</td><td valign="top">the stock ID for a stock image to display. Default
value: <tt class="literal">None</tt></td></tr><tr valign="top"><td valign="top">"storage-type"</td><td valign="top">Read</td><td valign="top">the type of the image data; one of the <a href="gtk-constants.html#gtk-image-type-constants">GTK Image Type Constants</a>:
<tt class="literal">gtk.IMAGE_EMPTY</tt>, <tt class="literal">gtk.IMAGE_PIXMAP</tt>,
<tt class="literal">gtk.IMAGE_IMAGE</tt>, <tt class="literal">gtk.IMAGE_PIXBUF</tt>,
<tt class="literal">gtk.IMAGE_STOCK</tt>, <tt class="literal">gtk.IMAGE_ICON_SET</tt> or
<tt class="literal">gtk.IMAGE_ANIMATION</tt></td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id3443564"></a><h2>Description</h2><p>The <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> widget
displays an image. Various kinds of objects can be displayed as an image;
usually, you would load a <a href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><tt class="classname">gtk.gdk.Pixbuf</tt></a>
("pixel buffer") from a file, and then display it. The convenience method
<a href="class-gtkimage.html#method-gtkimage--set-from-file" title="gtk.Image.set_from_file"><tt class="methodname">set_from_file</tt>()</a> 
will read the file and automatically create a pixbuf that is added to the
<a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a>
widget. If the file isn't loaded successfully, the image will contain a
"broken image" icon similar to that used in many web browsers. If you want
to handle errors in loading the file yourself, for example by displaying an
error message, then load the image with <a href="class-gdkpixbuf.html#function-gdk--pixbuf-new-from-file" title="gtk.gdk.pixbuf_new_from_file"><tt class="methodname">gtk.gdk.pixbuf_new_from_file</tt>()</a>, 
then add it to the <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> with the
<a href="class-gtkimage.html#method-gtkimage--set-from-pixbuf" title="gtk.Image.set_from_pixbuf"><tt class="methodname">set_from_pixbuf</tt>()</a> 
method. The image file may contain an animation; if so, the <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> will
display an animation (<a href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><tt class="classname">gtk.gdk.PixbufAnimation</tt></a>) 
instead of a static image.</p><p><a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> is a
subclass of <a href="class-gtkmisc.html" title="gtk.Misc"><tt class="classname">gtk.Misc</tt></a>, which
implies that you can align it (center, left, right) and add padding to it,
using the <a href="class-gtkmisc.html" title="gtk.Misc"><tt class="classname">gtk.Misc</tt></a> methods.
<a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> is a
"no window" widget (has no <a href="class-gdkwindow.html" title="gtk.gdk.Window"><tt class="classname">gtk.gdk.Window</tt></a> of
its own), so by default does not receive events. If you want to receive
events on the image, such as button clicks, place the image inside a <a href="class-gtkeventbox.html" title="gtk.EventBox"><tt class="classname">gtk.EventBox</tt></a>, then
connect to the event signals on the event box.</p><p>When handling events on the event box, keep in mind that
coordinates in the image may be different from event box coordinates due to
the alignment and padding settings on the image (see <a href="class-gtkmisc.html" title="gtk.Misc"><tt class="classname">gtk.Misc</tt></a>). The
simplest way to solve this is to set the alignment to 0.0 (left/top), and
set the padding to zero. Then the origin of the image will be the same as
the origin of the event box.</p><p>Sometimes an application will want to avoid depending on external
data files, such as image files. GTK+ comes with a program to avoid this,
called <span><b class="command">gdk-pixbuf-csource</b></span>. This program allows you to
convert an image into a C variable declaration, which can then be loaded
into a <a href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><tt class="classname">gtk.gdk.Pixbuf</tt></a> using
the <a href="class-gdkpixbuf.html#function-gdk--pixbuf-new-from-inline" title="gtk.gdk.pixbuf_new_from_inline"><tt class="function">gtk.gdk.pixbuf_new_from_inline</tt>()</a>
function. This can also be used in <tt class="literal">PyGTK</tt> by modifying the
output using an editor or the <span><b class="command">sed</b></span> command as
follows:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  gdk-pixbuf-csource imagefile | \
          sed -n -e 's/{/[/' -e 's/};/]/' -e '/".*"/p' &gt;outfile
</pre></td></tr></table><p>You can edit <tt class="filename">outfile</tt> into a Python file where
it will be evaluated to a list containing a string. The string can be used
directly with the <a href="class-gdkpixbuf.html#function-gdk--pixbuf-new-from-inline" title="gtk.gdk.pixbuf_new_from_inline"><tt class="function">gtk.gdk.pixbuf_new_from_inline</tt>()</a>
function to create a pixbuf that can be used in a <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a>.</p></div><div class="refsect1" lang="en"><a name="constructor-gtkimage"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis">    <span class="methodname">gtk.Image</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>a newly created <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a>
widget.</td></tr></tbody></table><p>Creates a new empty <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a>
widget.</p></div><div class="refsect1" lang="en"><a name="id3443817"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtkimage--set-from-pixmap"></a><h3>gtk.Image.set_from_pixmap</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_from_pixmap</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>pixmap</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>mask</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>pixmap</tt></b>:</span></td><td>a <a href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><tt class="classname">gtk.gdk.Pixmap</tt></a></td></tr><tr><td><span class="term"><b class="parameter"><tt>mask</tt></b>:</span></td><td>a bitmap <a href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><tt class="classname">gtk.gdk.Pixmap</tt></a> or
<tt class="literal">None</tt></td></tr></tbody></table><p>The <tt class="methodname">set_from_pixmap</tt>() method sets the
image data from <i class="parameter"><tt>pixmap</tt></i> using
<i class="parameter"><tt>mask</tt></i>.</p></div><div class="refsect2" lang="en"><a name="method-gtkimage--set-from-image"></a><h3>gtk.Image.set_from_image</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_from_image</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>gdk_image</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>mask</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>gdk_image</tt></b>:</span></td><td>a <a href="class-gdkimage.html" title="gtk.gdk.Image"><tt class="classname">gtk.gdk.Image</tt></a> or
<tt class="literal">None</tt></td></tr><tr><td><span class="term"><b class="parameter"><tt>mask</tt></b>:</span></td><td>a bitmap <a href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><tt class="classname">gtk.gdk.Pixmap</tt></a> or
<tt class="literal">None</tt></td></tr></tbody></table><p>The <tt class="methodname">set_from_image</tt>() method sets the
image data from <i class="parameter"><tt>image</tt></i> using
<i class="parameter"><tt>mask</tt></i>. A <a href="class-gdkimage.html" title="gtk.gdk.Image"><tt class="classname">gtk.gdk.Image</tt></a> is a
client-side image buffer in the pixel format of the current display. If
<i class="parameter"><tt>image</tt></i> is <tt class="literal">None</tt> the current image
data will be removed.</p></div><div class="refsect2" lang="en"><a name="method-gtkimage--set-from-file"></a><h3>gtk.Image.set_from_file</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_from_file</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>filename</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>filename</tt></b>:</span></td><td>a filename or
<tt class="literal">None</tt></td></tr></tbody></table><p>The <tt class="methodname">set_from_file</tt>() method sets the
image data from the contents of the file named
<i class="parameter"><tt>filename</tt></i>. If the file isn't found or can't be loaded,
the resulting <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> will
display a "broken image" icon. This function never returns None, it always
returns a valid <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> widget. If
the file contains an animation, the image will contain an animation. If
<i class="parameter"><tt>filename</tt></i> is <tt class="literal">None</tt> the current image
data will be removed.</p><p>If you need to detect failures to load the file, use <a href="class-gdkpixbuf.html#function-gdk--pixbuf-new-from-file" title="gtk.gdk.pixbuf_new_from_file"><tt class="methodname">gtk.gdk.pixbuf_new_from_file</tt>()</a> 
to load the file yourself, then create the <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> from the
pixbuf. (Or for animations, use the <a href="class-gdkpixbufanimation.html#constructor-gdkpixbufanimation" title="Constructor">gtk.gdk.PixbufAnimation</a>()
constructor.</p></div><div class="refsect2" lang="en"><a name="method-gtkimage--set-from-pixbuf"></a><h3>gtk.Image.set_from_pixbuf</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_from_pixbuf</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>pixbuf</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>pixbuf</tt></b>:</span></td><td>a <a href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><tt class="classname">gtk.gdk.Pixbuf</tt></a> or
<tt class="literal">None</tt></td></tr></tbody></table><p>The <tt class="methodname">set_from_pixbuf</tt>() method sets the
image data using <i class="parameter"><tt>pixbuf</tt></i>. Note that this function just
creates an <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> from
<i class="parameter"><tt>pixbuf</tt></i>. The <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> created
will not react to state changes. Should you want that, you should use the
<a href="class-gtkimage.html#method-gtkimage--set-from-icon-set" title="gtk.Image.set_from_icon_set"><tt class="methodname">set_from_icon_set</tt>()</a> 
method If <i class="parameter"><tt>pixbuf</tt></i> is <tt class="literal">None</tt> the
current image data will be removed.</p></div><div class="refsect2" lang="en"><a name="method-gtkimage--set-from-stock"></a><h3>gtk.Image.set_from_stock</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_from_stock</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>stock_id</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</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>stock_id</tt></b>:</span></td><td>a stock icon name</td></tr><tr><td><span class="term"><b class="parameter"><tt>size</tt></b>:</span></td><td>a stock icon size</td></tr></tbody></table><p>The <tt class="methodname">set_from_stock</tt>() method sets the
image data from the stock item identified by
<i class="parameter"><tt>stock_id</tt></i>. Sample stock icon names are
<tt class="literal">gtk.STOCK_OPEN</tt> and <tt class="literal">gtk.STOCK_OK</tt>.
Stock icon sizes are <tt class="literal">gtk.ICON_SIZE_MENU</tt>,
<tt class="literal">gtk.ICON_SIZE_SMALL_TOOLBAR</tt>,
<tt class="literal">gtk.ICON_SIZE_LARGE_TOOLBAR</tt>,
<tt class="literal">gtk.ICON_SIZE_BUTTON</tt>,
<tt class="literal">gtk.ICON_SIZE_DND</tt> and
<tt class="literal">gtk.ICON_SIZE_DIALOG</tt>. If the stock icon name isn't known,
a "broken image" icon will be displayed instead. You can register your own
stock icon names, see the <a href="class-gtkiconfactory.html#method-gtkiconfactory--add-default" title="gtk.IconFactory.add_default"><tt class="methodname">gtk.IconFactory.add_default</tt>()</a> 
and <a href="class-gtkiconfactory.html#method-gtkiconfactory--add" title="gtk.IconFactory.add"><tt class="methodname">gtk.IconFactory.add</tt>()</a> 
methods.</p><p>The stock icons are described in the <a href="gtk-stock-items.html" title="Stock Items">Stock Items</a> reference.</p></div><div class="refsect2" lang="en"><a name="method-gtkimage--set-from-icon-set"></a><h3>gtk.Image.set_from_icon_set</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_from_icon_set</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>icon_set</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</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>icon_set</tt></b>:</span></td><td>a <a href="class-gtkiconset.html" title="gtk.IconSet"><tt class="classname">gtk.IconSet</tt></a></td></tr><tr><td><span class="term"><b class="parameter"><tt>size</tt></b>:</span></td><td>a stock icon size</td></tr></tbody></table><p>The <tt class="methodname">set_from_icon_set</tt>() method sets the
image data from icon_set with the size specified by
<i class="parameter"><tt>size</tt></i>. Stock icon sizes are
<tt class="literal">gtk.ICON_SIZE_MENU</tt>,
<tt class="literal">gtk.ICON_SIZE_SMALL_TOOLBAR</tt>,
<tt class="literal">gtk.ICON_SIZE_LARGE_TOOLBAR</tt>,
<tt class="literal">gtk.ICON_SIZE_BUTTON</tt>,
<tt class="literal">gtk.ICON_SIZE_DND</tt> and
<tt class="literal">gtk.ICON_SIZE_DIALOG</tt>.</p></div><div class="refsect2" lang="en"><a name="method-gtkimage--set-from-animation"></a><h3>gtk.Image.set_from_animation</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_from_animation</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>animation</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>animation</tt></b>:</span></td><td>the <a href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><tt class="classname">gtk.gdk.PixbufAnimation</tt></a></td></tr></tbody></table><p>The <tt class="methodname">set_from_animation</tt>() method sets
the image data from <i class="parameter"><tt>animation</tt></i>.</p></div><div class="refsect2" lang="en"><a name="method-gtkimage--get-storage-type"></a><h3>gtk.Image.get_storage_type</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_storage_type</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 type of the image representation being
used</td></tr></tbody></table><p>The <tt class="methodname">get_storage_type</tt>() method gets the
type of representation being used by the <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> to store
image data. If the <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> has no
image data, the return value will be <tt class="literal">gtk.IMAGE_EMPTY</tt>. The
image type is one of: <tt class="literal">gtk.IMAGE_EMPTY</tt>,
<tt class="literal">gtk.IMAGE_PIXMAP</tt>, <tt class="literal">gtk.IMAGE_IMAGE</tt>,
<tt class="literal">gtk.IMAGE_PIXBUF</tt>, <tt class="literal">gtk.IMAGE_STOCK</tt>,
<tt class="literal">gtk.IMAGE_ICON_SET</tt> or
<tt class="literal">gtk.IMAGE_ANIMATION</tt>.</p></div><div class="refsect2" lang="en"><a name="method-gtkimage--get-pixmap"></a><h3>gtk.Image.get_pixmap</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_pixmap</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>a tuple containing the pixmap (or
<tt class="literal">None</tt>) and the mask (or
<tt class="literal">None</tt>)</td></tr></tbody></table><p>The <tt class="methodname">get_pixmap</tt>() method returns a tuple
containing the pixmap and mask being displayed by the <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a>. Either or
both the pixmap and mask may be <tt class="literal">None</tt>. If the storage type
of the image is not either <tt class="literal">gtk.IMAGE_EMPTY</tt> or
<tt class="literal">gtk.IMAGE_PIXMAP</tt> the ValueError exception will be
raised.</p></div><div class="refsect2" lang="en"><a name="method-gtkimage--get-image"></a><h3>gtk.Image.get_image</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_image</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>a tuple containing a <a href="class-gdkimage.html" title="gtk.gdk.Image"><tt class="classname">gtk.gdk.Image</tt></a> and a
mask bitmap</td></tr></tbody></table><p>The <tt class="methodname">get_image</tt>() method returns a tuple
containing the <a href="class-gdkimage.html" title="gtk.gdk.Image"><tt class="classname">gtk.gdk.Image</tt></a> and
mask being displayed by the <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a>. One or
both of the <a href="class-gdkimage.html" title="gtk.gdk.Image"><tt class="classname">gtk.gdk.Image</tt></a> and
mask may be <tt class="literal">None</tt>. If the storage type of the image is not
either of <tt class="literal">gtk.IMAGE_EMPTY</tt> or
<tt class="literal">gtk.IMAGE_IMAGE</tt> the ValueError exception will be
raised.</p></div><div class="refsect2" lang="en"><a name="method-gtkimage--get-pixbuf"></a><h3>gtk.Image.get_pixbuf</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_pixbuf</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 displayed pixbuf, or
<tt class="literal">None</tt> if the image is empty</td></tr></tbody></table><p>The <tt class="methodname">get_pixbuf</tt>() method gets the <a href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><tt class="classname">gtk.gdk.Pixbuf</tt></a> being
displayed by the <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a>. The return
value may be None if no image data is set. If the storage type of the image
is not either <tt class="literal">gtk.IMAGE_EMPTY</tt> or
<tt class="literal">gtk.IMAGE_PIXBUF</tt> the ValueError exception will be
raised.</p></div><div class="refsect2" lang="en"><a name="method-gtkimage--get-stock"></a><h3>gtk.Image.get_stock</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_stock</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>a tuple containing the stock icon name and the
stock icon size of the image data</td></tr></tbody></table><p>The <tt class="methodname">get_stock</tt>() method returns a tuple
containing the stock icon identifier (may be <tt class="literal">None</tt>) and
size being displayed by the <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a>. The size
will be one of: <tt class="literal">gtk.ICON_SIZE_MENU</tt>,
<tt class="literal">gtk.ICON_SIZE_SMALL_TOOLBAR</tt>,
<tt class="literal">gtk.ICON_SIZE_LARGE_TOOLBAR</tt>,
<tt class="literal">gtk.ICON_SIZE_BUTTON</tt>,
<tt class="literal">gtk.ICON_SIZE_DND</tt> or
<tt class="literal">gtk.ICON_SIZE_DIALOG</tt>. If the storage type of the image is
not either <tt class="literal">gtk.IMAGE_EMPTY</tt> or
<tt class="literal">gtk.IMAGE_STOCK</tt> the ValueError exception will be
raised.</p></div><div class="refsect2" lang="en"><a name="method-gtkimage--get-icon-set"></a><h3>gtk.Image.get_icon_set</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_icon_set</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>a tuple containing a <a href="class-gtkiconset.html" title="gtk.IconSet"><tt class="classname">gtk.IconSet</tt></a> and a
stock icon size</td></tr></tbody></table><p>The <tt class="methodname">get_icon_set</tt>() method returns a
tuple containing the icon set (may be <tt class="literal">None</tt>) and size
being displayed by the <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a>. The size
will be one of: <tt class="literal">gtk.ICON_SIZE_MENU</tt>,
<tt class="literal">gtk.ICON_SIZE_SMALL_TOOLBAR</tt>,
<tt class="literal">gtk.ICON_SIZE_LARGE_TOOLBAR</tt>,
<tt class="literal">gtk.ICON_SIZE_BUTTON</tt>,
<tt class="literal">gtk.ICON_SIZE_DND</tt> or
<tt class="literal">gtk.ICON_SIZE_DIALOG</tt>. If the storage type of the image is
not either <tt class="literal">gtk.IMAGE_EMPTY</tt> or
<tt class="literal">gtk.IMAGE_ICON_SET</tt> the ValueError exception will be
raised.</p></div><div class="refsect2" lang="en"><a name="method-gtkimage--get-animation"></a><h3>gtk.Image.get_animation</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_animation</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 displayed animation, or
<tt class="literal">None</tt> if the image is empty</td></tr></tbody></table><p>The <tt class="methodname">get_animation</tt>() method gets the
<a href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><tt class="classname">gtk.gdk.PixbufAnimation</tt></a> 
(may be None if there is no image data) being displayed by the <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a>. If the
storage type of the image is not either <tt class="literal">gtk.IMAGE_EMPTY</tt>
or <tt class="literal">gtk.IMAGE_ANIMATION</tt> the ValueError exception will be
raised.</p></div><div class="refsect2" lang="en"><a name="method-gtkimage--get-icon-name"></a><h3>gtk.Image.get_icon_name</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_icon_name</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>a 2-tuple containing the name and size of the
displayed icon.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <tt class="methodname">get_icon_name</tt>() method returns a
2-tuple containing the values of the "icon-name" and "icon-size" properties
respectively if the "icon-name" property is not <tt class="literal">None</tt>. If
the "icon-name" property is <tt class="literal">None</tt> the 2-tuple returned
will be:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  (None, &lt;enum GTK_ICON_SIZE_INVALID of type GtkIconSize&gt;)
</pre></td></tr></table></div><div class="refsect2" lang="en"><a name="method-gtkimage--set-from-icon-name"></a><h3>gtk.Image.set_from_icon_name</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_from_icon_name</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>icon_name</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</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>icon_name</tt></b>:</span></td><td>an icon name</td></tr><tr><td><span class="term"><b class="parameter"><tt>size</tt></b>:</span></td><td>a stock icon size</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <tt class="methodname">set_from_icon_name</tt>() method sets
the "icon-name" and "icon-size" properties to the values of
<i class="parameter"><tt>icon_name</tt></i> and <i class="parameter"><tt>size</tt></i>
respectively. <i class="parameter"><tt>icon_name</tt></i> should be the name of an icon
in the current icon theme. If <i class="parameter"><tt>icon_name</tt></i> isn't known,
a "broken image" icon will be displayed instead. If the current icon theme
is changed, the icon will be updated appropriately.</p></div><div class="refsect2" lang="en"><a name="method-gtkimage--set-pixel-size"></a><h3>gtk.Image.set_pixel_size</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_pixel_size</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>pixel_size</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>pixel_size</tt></b>:</span></td><td>the new pixel size to be used for named
icons</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <tt class="methodname">set_pixel_size</tt>() method sets the
"pixel-size" property to the value specified by
<i class="parameter"><tt>pixel_size</tt></i>. If the pixel size is set to a value != -1
the "pixel-size" property is used instead of the icon size set by the <a href="class-gtkimage.html#method-gtkimage--set-from-icon-name" title="gtk.Image.set_from_icon_name"><tt class="methodname">set_from_icon_name</tt>()</a>
method.</p></div><div class="refsect2" lang="en"><a name="method-gtkimage--get-pixel-size"></a><h3>gtk.Image.get_pixel_size</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_pixel_size</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 pixel size used for named
icons.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <tt class="methodname">get_pixel_size</tt>() method returns the
value of the "pixel-size" property which specifies the pixel size to be used
for named icons.</p></div></div><div class="refsect1" lang="en"><a name="id3445302"></a><h2>Functions</h2><div class="refsect2" lang="en"><a name="function-gtk--image-new-from-stock"></a><h3>gtk.image_new_from_stock</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">gtk.image_new_from_stock</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>stock_id</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</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>stock_id</tt></b>:</span></td><td>a stock icon name</td></tr><tr><td><span class="term"><b class="parameter"><tt>size</tt></b>:</span></td><td>an integer representing an icon
size</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a>
	  displaying the stock icon</td></tr></tbody></table><p>The <tt class="function">gtk.image_new_from_stock</tt>() function
returns a new <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> displaying
the stock icon specified by <i class="parameter"><tt>stock_id</tt></i> with the
specified <i class="parameter"><tt>size</tt></i>. Sample stock icon names are
<tt class="literal">gtk.STOCK_OPEN</tt>, <tt class="literal">gtk.STOCK_OK</tt> - see the
<a href="class-gtkimage.html#method-gtkimage--set-from-stock" title="gtk.Image.set_from_stock"><tt class="methodname">set_from_stock</tt>()</a> 
method for detailed information on the <tt class="literal">PyGTK</tt> stock icons.
. Sample stock sizes are <tt class="literal">gtk.ICON_SIZE_MENU</tt>,
<tt class="literal">gtk.ICON_SIZE_SMALL_TOOLBAR</tt> - see the <a href="class-gtkiconsource.html#function-gtk--icon-size-lookup" title="gtk.icon_size_lookup"><tt class="function">gtk.icon_size_lookup</tt>()</a> function for more detail. If the stock icon name isn't
known, a "broken image" icon will be displayed instead. You can register
your own stock icon names, see the <a href="class-gtkiconfactory.html#method-gtkiconfactory--add-default" title="gtk.IconFactory.add_default"><tt class="methodname">gtk.IconFactory.add_default</tt>()</a> 
and <a href="class-gtkiconfactory.html#method-gtkiconfactory--add" title="gtk.IconFactory.add"><tt class="methodname">gtk.IconFactory.add</tt>()</a> 
methods.</p></div><div class="refsect2" lang="en"><a name="function-gtk--image-new-from-icon-set"></a><h3>gtk.image_new_from_icon_set</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">gtk.image_new_from_icon_set</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>icon_set</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</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>icon_set</tt></b>:</span></td><td>a <a href="class-gtkiconset.html" title="gtk.IconSet"><tt class="classname">gtk.IconSet</tt></a>
object</td></tr><tr><td><span class="term"><b class="parameter"><tt>size</tt></b>:</span></td><td>an integer representing an icon
size</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a>
object</td></tr></tbody></table><p>The <tt class="function">gtk.image_new_from_icon_set</tt>() function
returns a new <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> created
from the <a href="class-gtkiconset.html" title="gtk.IconSet"><tt class="classname">gtk.IconSet</tt></a>
specified by <i class="parameter"><tt>icon_set</tt></i> with the specified
<i class="parameter"><tt>size</tt></i>. Sample stock sizes are
<tt class="literal">gtk.ICON_SIZE_MENU</tt>,
<tt class="literal">gtk.ICON_SIZE_SMALL_TOOLBAR</tt> - see the <a href="class-gtkiconsource.html#function-gtk--icon-size-lookup" title="gtk.icon_size_lookup"><tt class="function">gtk.icon_size_lookup</tt>()</a> 
function for more detail. Instead of using this function, usually it's
better to create a <a href="class-gtkiconfactory.html" title="gtk.IconFactory"><tt class="classname">gtk.IconFactory</tt></a>, 
put your icon sets in the icon factory, add the icon factory to the list of
default factories with the <a href="class-gtkiconfactory.html#method-gtkiconfactory--add-default" title="gtk.IconFactory.add_default"><tt class="methodname">add_default</tt>()</a> 
method, and then use the <a href="class-gtkimage.html#function-gtk--image-new-from-stock" title="gtk.image_new_from_stock"><tt class="function">gtk.image_new_from_stock</tt>()</a> 
function. This will allow themes to override the icon you ship with your
application.</p></div><div class="refsect2" lang="en"><a name="function-gtk--image-new-from-animation"></a><h3>gtk.image_new_from_animation</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">gtk.image_new_from_animation</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>animation</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>animation</tt></b>:</span></td><td>a <a href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><tt class="classname">gtk.gdk.PixbufAnimation</tt></a> 
object</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a>
object</td></tr></tbody></table><p>The <tt class="function">gtk.image_new_from_animation</tt>() function
returns a new <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> object
containing the <a href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><tt class="classname">gtk.gdk.PixbufAnimation</tt></a> 
specified by <i class="parameter"><tt>animation</tt></i>.</p></div><div class="refsect2" lang="en"><a name="function-gtk--image-new-from-icon_name"></a><h3>gtk.image_new_from_icon_name</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">gtk.image_new_from_icon_name</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>icon_name</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</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>icon_name</tt></b>:</span></td><td>an icon name</td></tr><tr><td><span class="term"><b class="parameter"><tt>size</tt></b>:</span></td><td>a stock icon size</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a>
widget.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This function is available in PyGTK 2.6 and above.</p></div><p>The <tt class="function">gtk.image_new_from_icon_name</tt>() function
returns a new <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> object
displaying the named theme icon specified by
<i class="parameter"><tt>icon_name</tt></i> with the icon size specified by
<i class="parameter"><tt>size</tt></i>. If the icon name isn't known, a "broken image"
icon will be displayed instead. If the current icon theme is changed, the
icon will be updated appropriately. The "icon-name" and "icon-size"
properties are also set by this function.</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-gtkiconview.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-gtkimagemenuitem.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.IconView</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">gtk.ImageMenuItem</td></tr></table></div></body></html>