/usr/share/gtk-doc/html/pygtk/class-gtkimage.html is in python-gtk2-doc 2.24.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.Image</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><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="prev" 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" title="gtk.Image"><a name="class-gtkimage"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.Image</h2><p>gtk.Image — A widget displaying an image
</p></div><div class="refsect1" title="Synopsis"><a name="id3752495"></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 class="link" href="class-gtkmisc.html" title="gtk.Misc">gtk.Misc</a></span></span>):
<code class="constructorsynopsis"> <span class="methodname"><a class="link" 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 class="link" 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"><strong class="parameter"><code>pixmap</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>mask</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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"><strong class="parameter"><code>gdk_image</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>mask</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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"><strong class="parameter"><code>filename</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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"><strong class="parameter"><code>pixbuf</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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"><strong class="parameter"><code>stock_id</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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"><strong class="parameter"><code>icon_set</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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"><strong class="parameter"><code>animation</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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 class="link" href="class-gtkimage.html#method-gtkimage--get-pixmap" title="gtk.Image.get_pixmap">get_pixmap</a></span>()</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkimage.html#method-gtkimage--get-image" title="gtk.Image.get_image">get_image</a></span>()</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkimage.html#method-gtkimage--get-pixbuf" title="gtk.Image.get_pixbuf">get_pixbuf</a></span>()</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkimage.html#method-gtkimage--get-stock" title="gtk.Image.get_stock">get_stock</a></span>()</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkimage.html#method-gtkimage--get-icon-set" title="gtk.Image.get_icon_set">get_icon_set</a></span>()</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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 class="link" 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 class="link" 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"><strong class="parameter"><code>icon_name</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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"><strong class="parameter"><code>pixel_size</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkimage.html#method-gtkimage--clear" title="gtk.Image.clear">clear</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkimage.html#method-gtkimage--set-from-gicon" title="gtk.Image.set_from_gicon">set_from_gicon</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>gicon</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code><br></pre></td></tr></table><pre class="programlisting">
<span class="bold"><strong>Functions</strong></span>
<code class="methodsynopsis"> def <span class="methodname"><a class="link" 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"><strong class="parameter"><code>stock_id</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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"><strong class="parameter"><code>icon_set</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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"><strong class="parameter"><code>animation</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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"><strong class="parameter"><code>icon_name</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkimage.html#function-gtk--image-new-from-pixmap" title="gtk.image_new_from_pixmap">gtk.image_new_from_pixmap</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>pixmap</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>mask</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkimage.html#function-gtk--image-new-from-image" title="gtk.image_new_from_image">gtk.image_new_from_image</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>image</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>mask</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkimage.html#function-gtk--image-new-from-file" title="gtk.image_new_from_file">gtk.image_new_from_file</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>filename</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkimage.html#function-gtk--image-new-from-pixbuf" title="gtk.image_new_from_pixbuf">gtk.image_new_from_pixbuf</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>pixbuf</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkimage.html#function-gtk--image-new-from-gicon" title="gtk.image_new_from_gicon">gtk.image_new_from_gicon</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>gicon</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code></pre></div><div class="refsect1" title="Ancestry"><a name="id3753403"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
+-- <a class="link" href="class-gtkobject.html" title="gtk.Object">gtk.Object</a>
+-- <a class="link" href="class-gtkwidget.html" title="gtk.Widget">gtk.Widget</a>
+-- <a class="link" href="class-gtkmisc.html" title="gtk.Misc">gtk.Misc</a>
+-- <a class="link" href="class-gtkimage.html" title="gtk.Image">gtk.Image</a>
</pre></div><div class="refsect1" title="Implemented Interfaces"><a name="id3753448"></a><h2>Implemented Interfaces</h2><p>
<a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>
implements
<a class="link" href="class-gtkbuildable.html" title="gtk.Buildable"><code class="classname">gtk.Buildable</code></a>
</p></div><div class="refsect1" title="gtk.Image Properties"><a name="properties-gtkimage"></a><h2>gtk.Image Properties</h2><p><a class="link" href="class-gtkobject.html#properties-gtkobject" title="gtk.Object Properties">gtk.Object Properties</a></p><p><a class="link" href="class-gtkwidget.html#properties-gtkwidget" title="gtk.Widget Properties">gtk.Widget Properties</a></p><p><a class="link" href="class-gtkmisc.html#properties-gtkmisc" title="gtk.Misc Properties">gtk.Misc Properties</a></p><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table width="100%" border="0"><colgroup><col width="1in"><col width="1in"><col width="4in"></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:
<code class="literal">None</code></td></tr><tr valign="top"><td valign="top">"gicon"</td><td valign="top">Read-Write</td><td valign="top">The GIcon displayed in the GtkImage. For themed icons,
If the icon theme is changed, the image will be updated automatically.
Available in GTK 2.14 and above.</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:
<code class="literal">None</code>. 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 class="link" href="class-gtkiconset.html" title="gtk.IconSet"><code class="classname">gtk.IconSet</code></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: >= 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 class="link" href="class-gdkimage.html" title="gtk.gdk.Image"><code class="classname">gtk.gdk.Image</code></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 class="link" href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><code class="classname">gtk.gdk.Pixmap</code></a> to
use with a <a class="link" href="class-gdkimage.html" title="gtk.gdk.Image"><code class="classname">gtk.gdk.Image</code></a> or a
<a class="link" href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><code class="classname">gtk.gdk.Pixmap</code></a></td></tr><tr valign="top"><td valign="top">"pixbuf"</td><td valign="top">Read-Write</td><td valign="top">the <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></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 class="link" href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><code class="classname">gtk.gdk.PixbufAnimation</code></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 <code class="literal">gtk.IMAGE_ICON_NAME</code>. Allowed values: >=
-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 class="link" href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><code class="classname">gtk.gdk.Pixmap</code></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: <code class="literal">None</code></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 class="xref" href="gtk-constants.html#gtk-image-type-constants" title="GTK Image Type Constants">GTK Image Type Constants</a>:
<code class="literal">gtk.IMAGE_EMPTY</code>, <code class="literal">gtk.IMAGE_PIXMAP</code>,
<code class="literal">gtk.IMAGE_IMAGE</code>, <code class="literal">gtk.IMAGE_PIXBUF</code>,
<code class="literal">gtk.IMAGE_STOCK</code>, <code class="literal">gtk.IMAGE_ICON_SET</code> or
<code class="literal">gtk.IMAGE_ANIMATION</code></td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" title="gtk.Image Style Properties"><a name="style-properties-gtkimage"></a><h2>gtk.Image Style Properties</h2><p><a class="link" href="class-gtkwidget.html#style-properties-gtkwidget" title="gtk.Widget Style Properties">gtk.Widget Style Properties</a></p></div><div class="refsect1" title="gtk.Image Signal Prototypes"><a name="signal-prototypes-gtkimage"></a><h2>gtk.Image Signal Prototypes</h2><p><PYGTKDOCLINK HREF="signal-prototypes-gobject">gobject.GObject Signal Prototypes</PYGTKDOCLINK></p><p><a class="link" href="class-gtkobject.html#signal-prototypes-gtkobject" title="gtk.Object Signal Prototypes">gtk.Object Signal Prototypes</a></p><p><a class="link" href="class-gtkwidget.html#signal-prototypes-gtkwidget" title="gtk.Widget Signal Prototypes">gtk.Widget Signal Prototypes</a></p></div><div class="refsect1" title="Description"><a name="id3753969"></a><h2>Description</h2><p>The <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> widget
displays an image. Various kinds of objects can be displayed as an image;
usually, you would load a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
("pixel buffer") from a file, and then display it. The convenience method
<a class="link" href="class-gtkimage.html#method-gtkimage--set-from-file" title="gtk.Image.set_from_file"><code class="methodname">set_from_file</code>()</a>
will read the file and automatically create a pixbuf that is added to the
<a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></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 class="link" href="class-gdkpixbuf.html#function-gdk--pixbuf-new-from-file" title="gtk.gdk.pixbuf_new_from_file"><code class="methodname">gtk.gdk.pixbuf_new_from_file</code>()</a>,
then add it to the <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> with the
<a class="link" href="class-gtkimage.html#method-gtkimage--set-from-pixbuf" title="gtk.Image.set_from_pixbuf"><code class="methodname">set_from_pixbuf</code>()</a>
method. The image file may contain an animation; if so, the <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> will
display an animation (<a class="link" href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><code class="classname">gtk.gdk.PixbufAnimation</code></a>)
instead of a static image.</p><p><a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> is a
subclass of <a class="link" href="class-gtkmisc.html" title="gtk.Misc"><code class="classname">gtk.Misc</code></a>, which
implies that you can align it (center, left, right) and add padding to it,
using the <a class="link" href="class-gtkmisc.html" title="gtk.Misc"><code class="classname">gtk.Misc</code></a> methods.
<a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> is a
"no window" widget (has no <a class="link" href="class-gdkwindow.html" title="gtk.gdk.Window"><code class="classname">gtk.gdk.Window</code></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 class="link" href="class-gtkeventbox.html" title="gtk.EventBox"><code class="classname">gtk.EventBox</code></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 class="link" href="class-gtkmisc.html" title="gtk.Misc"><code class="classname">gtk.Misc</code></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 class="command"><strong>gdk-pixbuf-csource</strong></span>. This program allows you to
convert an image into a C variable declaration, which can then be loaded
into a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a> using
the <a class="link" href="class-gdkpixbuf.html#function-gdk--pixbuf-new-from-inline" title="gtk.gdk.pixbuf_new_from_inline"><code class="function">gtk.gdk.pixbuf_new_from_inline</code>()</a>
function. This can also be used in <code class="literal">PyGTK</code> by modifying the
output using an editor or the <span class="command"><strong>sed</strong></span> command as
follows:</p><pre class="programlisting">
gdk-pixbuf-csource imagefile | \
sed -n -e 's/{/[/' -e 's/};/]/' -e '/".*"/p' >outfile
</pre><p>You can edit <code class="filename">outfile</code> into a Python file where
it will be evaluated to a list containing a string. The string can be used
directly with the <a class="link" href="class-gdkpixbuf.html#function-gdk--pixbuf-new-from-inline" title="gtk.gdk.pixbuf_new_from_inline"><code class="function">gtk.gdk.pixbuf_new_from_inline</code>()</a>
function to create a pixbuf that can be used in a <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>.</p></div><div class="refsect1" title="Constructor"><a name="constructor-gtkimage"></a><h2>Constructor</h2><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">gtk.Image</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a newly created <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>
widget.</td></tr></tbody></table><p>Creates a new empty <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>
widget.</p></div><div class="refsect1" title="Methods"><a name="id3754283"></a><h2>Methods</h2><div class="refsect2" title="gtk.Image.set_from_pixmap"><a name="method-gtkimage--set-from-pixmap"></a><h3>gtk.Image.set_from_pixmap</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_from_pixmap</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>pixmap</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>mask</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>pixmap</code></strong> :</span></p></td><td>a <a class="link" href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><code class="classname">gtk.gdk.Pixmap</code></a></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>mask</code></strong> :</span></p></td><td>a bitmap <a class="link" href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><code class="classname">gtk.gdk.Pixmap</code></a> or
<code class="literal">None</code></td></tr></tbody></table><p>The <code class="methodname">set_from_pixmap</code>() method sets the
image data from <em class="parameter"><code>pixmap</code></em> using
<em class="parameter"><code>mask</code></em>.</p></div><div class="refsect2" title="gtk.Image.set_from_image"><a name="method-gtkimage--set-from-image"></a><h3>gtk.Image.set_from_image</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_from_image</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>gdk_image</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>mask</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>gdk_image</code></strong> :</span></p></td><td>a <a class="link" href="class-gdkimage.html" title="gtk.gdk.Image"><code class="classname">gtk.gdk.Image</code></a> or
<code class="literal">None</code></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>mask</code></strong> :</span></p></td><td>a bitmap <a class="link" href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><code class="classname">gtk.gdk.Pixmap</code></a> or
<code class="literal">None</code></td></tr></tbody></table><p>The <code class="methodname">set_from_image</code>() method sets the
image data from <em class="parameter"><code>image</code></em> using
<em class="parameter"><code>mask</code></em>. A <a class="link" href="class-gdkimage.html" title="gtk.gdk.Image"><code class="classname">gtk.gdk.Image</code></a> is a
client-side image buffer in the pixel format of the current display. If
<em class="parameter"><code>image</code></em> is <code class="literal">None</code> the current image
data will be removed.</p></div><div class="refsect2" title="gtk.Image.set_from_file"><a name="method-gtkimage--set-from-file"></a><h3>gtk.Image.set_from_file</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_from_file</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>filename</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>filename</code></strong> :</span></p></td><td>a filename or
<code class="literal">None</code></td></tr></tbody></table><p>The <code class="methodname">set_from_file</code>() method sets the
image data from the contents of the file named
<em class="parameter"><code>filename</code></em>. If the file isn't found or can't be loaded,
the resulting <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> will
display a "broken image" icon. This function never returns None, it always
returns a valid <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> widget. If
the file contains an animation, the image will contain an animation. If
<em class="parameter"><code>filename</code></em> is <code class="literal">None</code> the current image
data will be removed.</p><p>If you need to detect failures to load the file, use <a class="link" href="class-gdkpixbuf.html#function-gdk--pixbuf-new-from-file" title="gtk.gdk.pixbuf_new_from_file"><code class="methodname">gtk.gdk.pixbuf_new_from_file</code>()</a>
to load the file yourself, then create the <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> from the
pixbuf. (Or for animations, use the <a class="link" href="class-gdkpixbufanimation.html#constructor-gdkpixbufanimation" title="Constructor">gtk.gdk.PixbufAnimation</a>()
constructor.</p></div><div class="refsect2" title="gtk.Image.set_from_pixbuf"><a name="method-gtkimage--set-from-pixbuf"></a><h3>gtk.Image.set_from_pixbuf</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_from_pixbuf</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>pixbuf</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>pixbuf</code></strong> :</span></p></td><td>a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a> or
<code class="literal">None</code></td></tr></tbody></table><p>The <code class="methodname">set_from_pixbuf</code>() method sets the
image data using <em class="parameter"><code>pixbuf</code></em>. Note that this function just
creates an <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> from
<em class="parameter"><code>pixbuf</code></em>. The <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> created
will not react to state changes. Should you want that, you should use the
<a class="link" href="class-gtkimage.html#method-gtkimage--set-from-icon-set" title="gtk.Image.set_from_icon_set"><code class="methodname">set_from_icon_set</code>()</a>
method If <em class="parameter"><code>pixbuf</code></em> is <code class="literal">None</code> the
current image data will be removed.</p></div><div class="refsect2" title="gtk.Image.set_from_stock"><a name="method-gtkimage--set-from-stock"></a><h3>gtk.Image.set_from_stock</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_from_stock</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>stock_id</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>stock_id</code></strong> :</span></p></td><td>a stock icon name</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>size</code></strong> :</span></p></td><td>a stock icon size</td></tr></tbody></table><p>The <code class="methodname">set_from_stock</code>() method sets the
image data from the stock item identified by
<em class="parameter"><code>stock_id</code></em>. Sample stock icon names are
<code class="literal">gtk.STOCK_OPEN</code> and <code class="literal">gtk.STOCK_OK</code>.
Stock icon sizes are <code class="literal">gtk.ICON_SIZE_MENU</code>,
<code class="literal">gtk.ICON_SIZE_SMALL_TOOLBAR</code>,
<code class="literal">gtk.ICON_SIZE_LARGE_TOOLBAR</code>,
<code class="literal">gtk.ICON_SIZE_BUTTON</code>,
<code class="literal">gtk.ICON_SIZE_DND</code> and
<code class="literal">gtk.ICON_SIZE_DIALOG</code>. 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 class="link" href="class-gtkiconfactory.html#method-gtkiconfactory--add-default" title="gtk.IconFactory.add_default"><code class="methodname">gtk.IconFactory.add_default</code>()</a>
and <a class="link" href="class-gtkiconfactory.html#method-gtkiconfactory--add" title="gtk.IconFactory.add"><code class="methodname">gtk.IconFactory.add</code>()</a>
methods.</p><p>The stock icons are described in the <a class="link" href="gtk-stock-items.html" title="Stock Items">Stock Items</a> reference.</p></div><div class="refsect2" title="gtk.Image.set_from_icon_set"><a name="method-gtkimage--set-from-icon-set"></a><h3>gtk.Image.set_from_icon_set</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_from_icon_set</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>icon_set</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>icon_set</code></strong> :</span></p></td><td>a <a class="link" href="class-gtkiconset.html" title="gtk.IconSet"><code class="classname">gtk.IconSet</code></a></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>size</code></strong> :</span></p></td><td>a stock icon size</td></tr></tbody></table><p>The <code class="methodname">set_from_icon_set</code>() method sets the
image data from icon_set with the size specified by
<em class="parameter"><code>size</code></em>. Stock icon sizes are
<code class="literal">gtk.ICON_SIZE_MENU</code>,
<code class="literal">gtk.ICON_SIZE_SMALL_TOOLBAR</code>,
<code class="literal">gtk.ICON_SIZE_LARGE_TOOLBAR</code>,
<code class="literal">gtk.ICON_SIZE_BUTTON</code>,
<code class="literal">gtk.ICON_SIZE_DND</code> and
<code class="literal">gtk.ICON_SIZE_DIALOG</code>.</p></div><div class="refsect2" title="gtk.Image.set_from_animation"><a name="method-gtkimage--set-from-animation"></a><h3>gtk.Image.set_from_animation</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_from_animation</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>animation</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>animation</code></strong> :</span></p></td><td>the <a class="link" href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><code class="classname">gtk.gdk.PixbufAnimation</code></a></td></tr></tbody></table><p>The <code class="methodname">set_from_animation</code>() method sets
the image data from <em class="parameter"><code>animation</code></em>.</p></div><div class="refsect2" title="gtk.Image.get_storage_type"><a name="method-gtkimage--get-storage-type"></a><h3>gtk.Image.get_storage_type</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_storage_type</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the type of the image representation being
used</td></tr></tbody></table><p>The <code class="methodname">get_storage_type</code>() method gets the
type of representation being used by the <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> to store
image data. If the <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> has no
image data, the return value will be <code class="literal">gtk.IMAGE_EMPTY</code>. The
image type is one of: <code class="literal">gtk.IMAGE_EMPTY</code>,
<code class="literal">gtk.IMAGE_PIXMAP</code>, <code class="literal">gtk.IMAGE_IMAGE</code>,
<code class="literal">gtk.IMAGE_PIXBUF</code>, <code class="literal">gtk.IMAGE_STOCK</code>,
<code class="literal">gtk.IMAGE_ICON_SET</code> or
<code class="literal">gtk.IMAGE_ANIMATION</code>.</p></div><div class="refsect2" title="gtk.Image.get_pixmap"><a name="method-gtkimage--get-pixmap"></a><h3>gtk.Image.get_pixmap</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_pixmap</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a tuple containing the pixmap (or
<code class="literal">None</code>) and the mask (or
<code class="literal">None</code>)</td></tr></tbody></table><p>The <code class="methodname">get_pixmap</code>() method returns a tuple
containing the pixmap and mask being displayed by the <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>. Either or
both the pixmap and mask may be <code class="literal">None</code>. If the storage type
of the image is not either <code class="literal">gtk.IMAGE_EMPTY</code> or
<code class="literal">gtk.IMAGE_PIXMAP</code> the ValueError exception will be
raised.</p></div><div class="refsect2" title="gtk.Image.get_image"><a name="method-gtkimage--get-image"></a><h3>gtk.Image.get_image</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_image</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a tuple containing a <a class="link" href="class-gdkimage.html" title="gtk.gdk.Image"><code class="classname">gtk.gdk.Image</code></a> and a
mask bitmap</td></tr></tbody></table><p>The <code class="methodname">get_image</code>() method returns a tuple
containing the <a class="link" href="class-gdkimage.html" title="gtk.gdk.Image"><code class="classname">gtk.gdk.Image</code></a> and
mask being displayed by the <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>. One or
both of the <a class="link" href="class-gdkimage.html" title="gtk.gdk.Image"><code class="classname">gtk.gdk.Image</code></a> and
mask may be <code class="literal">None</code>. If the storage type of the image is not
either of <code class="literal">gtk.IMAGE_EMPTY</code> or
<code class="literal">gtk.IMAGE_IMAGE</code> the ValueError exception will be
raised.</p></div><div class="refsect2" title="gtk.Image.get_pixbuf"><a name="method-gtkimage--get-pixbuf"></a><h3>gtk.Image.get_pixbuf</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_pixbuf</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the displayed pixbuf, or
<code class="literal">None</code> if the image is empty</td></tr></tbody></table><p>The <code class="methodname">get_pixbuf</code>() method gets the <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a> being
displayed by the <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>. The return
value may be None if no image data is set. If the storage type of the image
is not either <code class="literal">gtk.IMAGE_EMPTY</code> or
<code class="literal">gtk.IMAGE_PIXBUF</code> the ValueError exception will be
raised.</p></div><div class="refsect2" title="gtk.Image.get_stock"><a name="method-gtkimage--get-stock"></a><h3>gtk.Image.get_stock</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_stock</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a tuple containing the stock icon name and the
stock icon size of the image data</td></tr></tbody></table><p>The <code class="methodname">get_stock</code>() method returns a tuple
containing the stock icon identifier (may be <code class="literal">None</code>) and
size being displayed by the <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>. The size
will be one of: <code class="literal">gtk.ICON_SIZE_MENU</code>,
<code class="literal">gtk.ICON_SIZE_SMALL_TOOLBAR</code>,
<code class="literal">gtk.ICON_SIZE_LARGE_TOOLBAR</code>,
<code class="literal">gtk.ICON_SIZE_BUTTON</code>,
<code class="literal">gtk.ICON_SIZE_DND</code> or
<code class="literal">gtk.ICON_SIZE_DIALOG</code>. If the storage type of the image is
not either <code class="literal">gtk.IMAGE_EMPTY</code> or
<code class="literal">gtk.IMAGE_STOCK</code> the ValueError exception will be
raised.</p></div><div class="refsect2" title="gtk.Image.get_icon_set"><a name="method-gtkimage--get-icon-set"></a><h3>gtk.Image.get_icon_set</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_icon_set</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a tuple containing a <a class="link" href="class-gtkiconset.html" title="gtk.IconSet"><code class="classname">gtk.IconSet</code></a> and a
stock icon size</td></tr></tbody></table><p>The <code class="methodname">get_icon_set</code>() method returns a
tuple containing the icon set (may be <code class="literal">None</code>) and size
being displayed by the <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>. The size
will be one of: <code class="literal">gtk.ICON_SIZE_MENU</code>,
<code class="literal">gtk.ICON_SIZE_SMALL_TOOLBAR</code>,
<code class="literal">gtk.ICON_SIZE_LARGE_TOOLBAR</code>,
<code class="literal">gtk.ICON_SIZE_BUTTON</code>,
<code class="literal">gtk.ICON_SIZE_DND</code> or
<code class="literal">gtk.ICON_SIZE_DIALOG</code>. If the storage type of the image is
not either <code class="literal">gtk.IMAGE_EMPTY</code> or
<code class="literal">gtk.IMAGE_ICON_SET</code> the ValueError exception will be
raised.</p></div><div class="refsect2" title="gtk.Image.get_animation"><a name="method-gtkimage--get-animation"></a><h3>gtk.Image.get_animation</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_animation</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the displayed animation, or
<code class="literal">None</code> if the image is empty</td></tr></tbody></table><p>The <code class="methodname">get_animation</code>() method gets the
<a class="link" href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><code class="classname">gtk.gdk.PixbufAnimation</code></a>
(may be None if there is no image data) being displayed by the <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>. If the
storage type of the image is not either <code class="literal">gtk.IMAGE_EMPTY</code>
or <code class="literal">gtk.IMAGE_ANIMATION</code> the ValueError exception will be
raised.</p></div><div class="refsect2" title="gtk.Image.get_icon_name"><a name="method-gtkimage--get-icon-name"></a><h3>gtk.Image.get_icon_name</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_icon_name</span>()</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a 2-tuple containing the name and size of the
displayed icon.</td></tr></tbody></table><div class="note" title="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 <code class="methodname">get_icon_name</code>() method returns a
2-tuple containing the values of the "icon-name" and "icon-size" properties
respectively if the "icon-name" property is not <code class="literal">None</code>. If
the "icon-name" property is <code class="literal">None</code> the 2-tuple returned
will be:</p><pre class="programlisting">
(None, <enum GTK_ICON_SIZE_INVALID of type GtkIconSize>)
</pre></div><div class="refsect2" title="gtk.Image.set_from_icon_name"><a name="method-gtkimage--set-from-icon-name"></a><h3>gtk.Image.set_from_icon_name</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_from_icon_name</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>icon_name</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>icon_name</code></strong> :</span></p></td><td>an icon name</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>size</code></strong> :</span></p></td><td>a stock icon size</td></tr></tbody></table><div class="note" title="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 <code class="methodname">set_from_icon_name</code>() method sets
the "icon-name" and "icon-size" properties to the values of
<em class="parameter"><code>icon_name</code></em> and <em class="parameter"><code>size</code></em>
respectively. <em class="parameter"><code>icon_name</code></em> should be the name of an icon
in the current icon theme. If <em class="parameter"><code>icon_name</code></em> 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" title="gtk.Image.set_pixel_size"><a name="method-gtkimage--set-pixel-size"></a><h3>gtk.Image.set_pixel_size</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_pixel_size</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>pixel_size</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>pixel_size</code></strong> :</span></p></td><td>the new pixel size to be used for named
icons</td></tr></tbody></table><div class="note" title="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 <code class="methodname">set_pixel_size</code>() method sets the
"pixel-size" property to the value specified by
<em class="parameter"><code>pixel_size</code></em>. 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 class="link" href="class-gtkimage.html#method-gtkimage--set-from-icon-name" title="gtk.Image.set_from_icon_name"><code class="methodname">set_from_icon_name</code>()</a>
method.</p></div><div class="refsect2" title="gtk.Image.get_pixel_size"><a name="method-gtkimage--get-pixel-size"></a><h3>gtk.Image.get_pixel_size</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_pixel_size</span>()</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the pixel size used for named
icons.</td></tr></tbody></table><div class="note" title="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 <code class="methodname">get_pixel_size</code>() method returns the
value of the "pixel-size" property which specifies the pixel size to be used
for named icons.</p></div><div class="refsect2" title="gtk.Image.clear"><a name="method-gtkimage--clear"></a><h3>gtk.Image.clear</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">clear</span>()</code></pre><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.8 and above.</p></div><p>The <code class="methodname">clear</code>() method removes the current
image, if any, and resets the "storage-type", "mask" and "icon-size"
properties. One of the "file", "icon-name", "icon-set", "image", "pixbuf",
"pixbuf-animation", "pixmap" or "stock" will be reset if there was an
existing image.</p></div><div class="refsect2" title="gtk.Image.set_from_gicon"><a name="method-gtkimage--set-from-gicon"></a><h3>gtk.Image.set_from_gicon</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_from_gicon</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>icon</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>icon</code></strong> :</span></p></td><td>an icon</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>size</code></strong> :</span></p></td><td>an icon size</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.14 and above.</p></div><p>
For the <code class="methodname">set_from_gicon</code>() method see
<code class="methodname"><a class="link" href="class-gtkimage.html#function-gtk--image-new-from-gicon" title="gtk.image_new_from_gicon">gtk.image_new_from_gicon</a></code>()
for details.
</p></div></div><div class="refsect1" title="Functions"><a name="id3756603"></a><h2>Functions</h2><div class="refsect2" title="gtk.image_new_from_stock"><a name="function-gtk--image-new-from-stock"></a><h3>gtk.image_new_from_stock</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.image_new_from_stock</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>stock_id</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>stock_id</code></strong> :</span></p></td><td>a stock icon name</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>size</code></strong> :</span></p></td><td>an integer representing an icon
size</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>
displaying the stock icon</td></tr></tbody></table><p>The <code class="function">gtk.image_new_from_stock</code>() function
returns a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> displaying
the stock icon specified by <em class="parameter"><code>stock_id</code></em> with the
specified <em class="parameter"><code>size</code></em>. Sample stock icon names are
<code class="literal">gtk.STOCK_OPEN</code>, <code class="literal">gtk.STOCK_OK</code> - see the
<a class="link" href="class-gtkimage.html#method-gtkimage--set-from-stock" title="gtk.Image.set_from_stock"><code class="methodname">set_from_stock</code>()</a>
method for detailed information on the <code class="literal">PyGTK</code> stock icons.
. Sample stock sizes are <code class="literal">gtk.ICON_SIZE_MENU</code>,
<code class="literal">gtk.ICON_SIZE_SMALL_TOOLBAR</code> - see the <a class="link" href="class-gtkiconsource.html#function-gtk--icon-size-lookup" title="gtk.icon_size_lookup"><code class="function">gtk.icon_size_lookup</code>()</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 class="link" href="class-gtkiconfactory.html#method-gtkiconfactory--add-default" title="gtk.IconFactory.add_default"><code class="methodname">gtk.IconFactory.add_default</code>()</a>
and <a class="link" href="class-gtkiconfactory.html#method-gtkiconfactory--add" title="gtk.IconFactory.add"><code class="methodname">gtk.IconFactory.add</code>()</a>
methods.</p></div><div class="refsect2" title="gtk.image_new_from_icon_set"><a name="function-gtk--image-new-from-icon-set"></a><h3>gtk.image_new_from_icon_set</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.image_new_from_icon_set</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>icon_set</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>icon_set</code></strong> :</span></p></td><td>a <a class="link" href="class-gtkiconset.html" title="gtk.IconSet"><code class="classname">gtk.IconSet</code></a>
object</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>size</code></strong> :</span></p></td><td>an integer representing an icon
size</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>
object</td></tr></tbody></table><p>The <code class="function">gtk.image_new_from_icon_set</code>() function
returns a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> created
from the <a class="link" href="class-gtkiconset.html" title="gtk.IconSet"><code class="classname">gtk.IconSet</code></a>
specified by <em class="parameter"><code>icon_set</code></em> with the specified
<em class="parameter"><code>size</code></em>. Sample stock sizes are
<code class="literal">gtk.ICON_SIZE_MENU</code>,
<code class="literal">gtk.ICON_SIZE_SMALL_TOOLBAR</code> - see the <a class="link" href="class-gtkiconsource.html#function-gtk--icon-size-lookup" title="gtk.icon_size_lookup"><code class="function">gtk.icon_size_lookup</code>()</a>
function for more detail. Instead of using this function, usually it's
better to create a <a class="link" href="class-gtkiconfactory.html" title="gtk.IconFactory"><code class="classname">gtk.IconFactory</code></a>,
put your icon sets in the icon factory, add the icon factory to the list of
default factories with the <a class="link" href="class-gtkiconfactory.html#method-gtkiconfactory--add-default" title="gtk.IconFactory.add_default"><code class="methodname">add_default</code>()</a>
method, and then use the <a class="link" href="class-gtkimage.html#function-gtk--image-new-from-stock" title="gtk.image_new_from_stock"><code class="function">gtk.image_new_from_stock</code>()</a>
function. This will allow themes to override the icon you ship with your
application.</p></div><div class="refsect2" title="gtk.image_new_from_animation"><a name="function-gtk--image-new-from-animation"></a><h3>gtk.image_new_from_animation</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.image_new_from_animation</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>animation</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>animation</code></strong> :</span></p></td><td>a <a class="link" href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><code class="classname">gtk.gdk.PixbufAnimation</code></a>
object</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>
object</td></tr></tbody></table><p>The <code class="function">gtk.image_new_from_animation</code>() function
returns a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> object
containing the <a class="link" href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><code class="classname">gtk.gdk.PixbufAnimation</code></a>
specified by <em class="parameter"><code>animation</code></em>.</p></div><div class="refsect2" title="gtk.image_new_from_icon_name"><a name="function-gtk--image-new-from-icon_name"></a><h3>gtk.image_new_from_icon_name</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.image_new_from_icon_name</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>icon_name</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>icon_name</code></strong> :</span></p></td><td>an icon name</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>size</code></strong> :</span></p></td><td>a stock icon size</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>
widget.</td></tr></tbody></table><div class="note" title="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 <code class="function">gtk.image_new_from_icon_name</code>() function
returns a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> object
displaying the named theme icon specified by
<em class="parameter"><code>icon_name</code></em> with the icon size specified by
<em class="parameter"><code>size</code></em>. 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 class="refsect2" title="gtk.image_new_from_pixmap"><a name="function-gtk--image-new-from-pixmap"></a><h3>gtk.image_new_from_pixmap</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.image_new_from_pixmap</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>pixmap</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>mask</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>pixmap</code></strong> :</span></p></td><td>a <a class="link" href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><code class="classname">gtk.gdk.Pixmap</code></a></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>mask</code></strong> :</span></p></td><td>the bitmap that is the transparency mask.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>
widget.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This function is available in PyGTK 2.12 and above.</p></div><p>The <code class="function">gtk.image_new_from_pixmap</code>() function
returns a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> object
displaying pixmap with a mask. A <a class="link" href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><code class="classname">gtk.gdk.Pixmap</code></a>
is a server-side image buffer in the pixel format of the current display.</p></div><div class="refsect2" title="gtk.image_new_from_image"><a name="function-gtk--image-new-from-image"></a><h3>gtk.image_new_from_image</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.image_new_from_image</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>image</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>mask</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>image</code></strong> :</span></p></td><td>a <a class="link" href="class-gdkimage.html" title="gtk.gdk.Image"><code class="classname">gtk.gdk.Image</code></a></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>mask</code></strong> :</span></p></td><td>the bitmap that is the transparency mask.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>
widget.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This function is available in PyGTK 2.12 and above.</p></div><p>The <code class="function">gtk.image_new_from_image</code>() function
returns a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> object
displaying an image with a mask. A <a class="link" href="class-gdkimage.html" title="gtk.gdk.Image"><code class="classname">gtk.gdk.Image</code></a>
is a client-side image buffer in the pixel format of the current display.</p></div><div class="refsect2" title="gtk.image_new_from_file"><a name="function-gtk--image-new-from-file"></a><h3>gtk.image_new_from_file</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.image_new_from_file</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>filename</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>filename</code></strong> :</span></p></td><td>a filename</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>
widget.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This function is available in PyGTK 2.12 and above.</p></div><p>The <code class="function">gtk.image_new_from_file</code>() function
returns a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> object
displaying the file filename. If the file isn't found or can't be loaded,
the resulting <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>
will display a "broken image" icon. This function never returns None,
it always returns a valid <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code>
</a> widget.</p><p>If the file contains an animation, the image will contain an animation.</p><p>If you need to detect failures to load the file, use <a class="link" href="class-gdkpixbuf.html#function-gdk--pixbuf-new-from-file" title="gtk.gdk.pixbuf_new_from_file">gtk.gdk.pixbuf_new_from_file</a>
to load the file yourself, then create the <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>
from the pixbuf. (Or for animations, use <a class="link" href="class-gdkpixbufanimation.html#constructor-gdkpixbufanimation" title="Constructor">gtk.gdk.PixbufAnimation</a>.
The storage type (<a class="link" href="class-gtkimage.html#method-gtkimage--get-storage-type" title="gtk.Image.get_storage_type">get_storage_type</a>)
of the returned image is not defined, it will be whatever is appropriate
for displaying the file.</p></div><div class="refsect2" title="gtk.image_new_from_pixbuf"><a name="function-gtk--image-new-from-pixbuf"></a><h3>gtk.image_new_from_pixbuf</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.image_new_from_pixbuf</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>pixbuf</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>pixbuf</code></strong> :</span></p></td><td>a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>
widget.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This function is available in PyGTK 2.12 and above.</p></div><p>The <code class="function">gtk.image_new_from_pixbuf</code>() function
returns a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> object
displaying pixbuf</p><p>Note that this function just creates a <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> from the pixbuf. The
<a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>
created will not react to state changes. Should you want that, you should use
<a class="link" 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>
</p></div><div class="refsect2" title="gtk.image_new_from_gicon"><a name="function-gtk--image-new-from-gicon"></a><h3>gtk.image_new_from_gicon</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.image_new_from_gicon</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>gicon</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>gicon</code></strong> :</span></p></td><td>a <PYGTKDOCLINK HREF="class-gioicon"><code class="classname">gio.Icon</code></PYGTKDOCLINK>
</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>size</code></strong> :</span></p></td><td>a stock icon size.
</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>
displaying the themed icon.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This function is available in PyGTK 2.14 and above.</p></div><p>The <code class="function">gtk.image_new_from_pixbuf</code>() function returns
a new <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a>
displaying an icon from the current icon theme. 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.
</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>
|