summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gtkimage.xml
blob: 3f77ebdc5b3dc0701725f61b320122d74488823b (plain)
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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-gtkimage">
  <refnamediv>
    <refname>gtk.Image</refname>
    <refpurpose>A widget displaying an image
</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.Image</classname></ooclass>
      <ooclass><classname><link
linkend="class-gtkmisc">gtk.Misc</link></classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link
linkend="constructor-gtkimage">gtk.Image</link></methodname>
	<methodparam></methodparam>  </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--set-from-pixmap">set_from_pixmap</link></methodname>
	<methodparam><parameter
		       role="keyword">pixmap</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">mask</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--set-from-image">set_from_image</link></methodname>
	<methodparam><parameter
		       role="keyword">gdk_image</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">mask</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--set-from-file">set_from_file</link></methodname>
	<methodparam><parameter
		       role="keyword">filename</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--set-from-pixbuf">set_from_pixbuf</link></methodname>
	<methodparam><parameter
		       role="keyword">pixbuf</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--set-from-stock">set_from_stock</link></methodname>
	<methodparam><parameter
		       role="keyword">stock_id</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">size</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--set-from-icon-set">set_from_icon_set</link></methodname>
	<methodparam><parameter
		       role="keyword">icon_set</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">size</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--set-from-animation">set_from_animation</link></methodname>
	<methodparam><parameter
		       role="keyword">animation</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--get-storage-type">get_storage_type</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--get-pixmap">get_pixmap</link></methodname>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--get-image">get_image</link></methodname>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--get-pixbuf">get_pixbuf</link></methodname>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--get-stock">get_stock</link></methodname>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--get-icon-set">get_icon_set</link></methodname>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--get-animation">get_animation</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--get-icon-name">get_icon_name</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--set-from-icon-name">set_from_icon_name</link></methodname>
	<methodparam><parameter
		       role="keyword">icon_name</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">size</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--set-pixel-size">set_pixel_size</link></methodname>
	<methodparam><parameter
		       role="keyword">pixel_size</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--get-pixel-size">get_pixel_size</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkimage--clear">clear</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkimage--set-from-gicon">set_from_gicon</link></methodname>
	<methodparam><parameter role="keyword">gicon</parameter></methodparam>
	<methodparam><parameter role="keyword">size</parameter></methodparam>
      </methodsynopsis>
    </classsynopsis>

<programlisting>
<emphasis role="bold">Functions</emphasis>

<methodsynopsis language="python">
    <methodname><link linkend="function-gtk--image-new-from-stock">gtk.image_new_from_stock</link></methodname>
    <methodparam><parameter role="keyword">stock_id</parameter></methodparam>
    <methodparam><parameter role="keyword">size</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--image-new-from-icon-set">gtk.image_new_from_icon_set</link></methodname>
    <methodparam><parameter role="keyword">icon_set</parameter></methodparam>
    <methodparam><parameter role="keyword">size</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--image-new-from-animation">gtk.image_new_from_animation</link></methodname>
    <methodparam><parameter role="keyword">animation</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--image-new-from-animation">gtk.image_new_from_icon_name</link></methodname>
    <methodparam><parameter role="keyword">icon_name</parameter></methodparam>
    <methodparam><parameter role="keyword">size</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--image-new-from-pixmap">gtk.image_new_from_pixmap</link></methodname>
    <methodparam><parameter role="keyword">pixmap</parameter></methodparam>
    <methodparam><parameter role="keyword">mask</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--image-new-from-image">gtk.image_new_from_image</link></methodname>
    <methodparam><parameter role="keyword">image</parameter></methodparam>
    <methodparam><parameter role="keyword">mask</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--image-new-from-file">gtk.image_new_from_file</link></methodname>
    <methodparam><parameter role="keyword">filename</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--image-new-from-pixbuf">gtk.image_new_from_pixbuf</link></methodname>
    <methodparam><parameter role="keyword">pixbuf</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--image-new-from-gicon">gtk.image_new_from_gicon</link></methodname>
    <methodparam><parameter role="keyword">gicon</parameter></methodparam>
    <methodparam><parameter role="keyword">size</parameter></methodparam>
  </methodsynopsis></programlisting>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gtkobject">gtk.Object</link>
    +-- <link linkend="class-gtkwidget">gtk.Widget</link>
      +-- <link linkend="class-gtkmisc">gtk.Misc</link>
        +-- <link linkend="class-gtkimage">gtk.Image</link>
</synopsis>

  </refsect1>
  
  <refsect1>
		<title>Implemented Interfaces</title>
		<para>
			<link linkend="class-gtkimage"><classname>gtk.Image</classname></link>
			implements 
			<link linkend="class-gtkbuildable"><classname>gtk.Buildable</classname></link>
		</para>
	</refsect1>

  <refsect1 id="properties-gtkimage">
    <title>gtk.Image Properties</title>

    <para><link linkend="properties-gtkobject">gtk.Object Properties</link></para>
    <para><link linkend="properties-gtkwidget">gtk.Widget Properties</link></para>
    <para><link linkend="properties-gtkmisc">gtk.Misc Properties</link></para>

    <blockquote role="properties">
      <informaltable pgwide="1" frame="none">
	<tgroup cols="3">
	  <colspec column="1" colwidth="1in"/>
	  <colspec column="2" colwidth="1in"/>
	  <colspec column="3" colwidth="4in"/>
	  <tbody>

	    <row valign="top">
	      <entry>"file"</entry>
	      <entry>Write</entry>

	      <entry>A filename containing the image data. Default value:
<literal>None</literal></entry>
	    </row>

	    <row valign="top">
	      <entry>"gicon"</entry>
	      <entry>Read-Write</entry>

	      <entry>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.</entry>
	    </row>

	    <row valign="top">
	      <entry>"icon-name"</entry>
	      <entry>Read-Write</entry>

	      <entry>The name of the icon in the icon theme. If the icon
theme is changed, the image will be updated automatically. Default value:
<literal>None</literal>. Available in GTK 2.6 and above.</entry>
	    </row>

	    <row valign="top">
	      <entry>"icon-set"</entry>
	      <entry>Read-Write</entry>
	      <entry>the <link
linkend="class-gtkiconset"><classname>gtk.IconSet</classname></link> to
display</entry>
	    </row>

	    <row valign="top">
	      <entry>"icon-size"</entry>
	      <entry>Read-Write</entry>

	      <entry>the size to use for a stock icon, named icon or icon
set. Allowed values: >= 0. Default value: 4</entry>
	    </row>

	    <row valign="top">
	      <entry>"image"</entry>
	      <entry>Read-Write</entry>
	      <entry>a <link
linkend="class-gdkimage"><classname>gtk.gdk.Image</classname></link> to
display</entry>
	    </row>

	    <row valign="top">
	      <entry>"mask"</entry>
	      <entry>Read-Write</entry>
	      <entry>a bitmap <link
linkend="class-gdkpixmap"><classname>gtk.gdk.Pixmap</classname></link> to
use with a <link
linkend="class-gdkimage"><classname>gtk.gdk.Image</classname></link> or a
<link
linkend="class-gdkpixmap"><classname>gtk.gdk.Pixmap</classname></link></entry>
	    </row>

	    <row valign="top">
	      <entry>"pixbuf"</entry>
	      <entry>Read-Write</entry>
	      <entry>the <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link> 
to display</entry>
	    </row>

	    <row valign="top">
	      <entry>"pixbuf-animation"</entry>
	      <entry>Read-Write</entry>
	      <entry>the <link
linkend="class-gdkpixbufanimation"><classname>gtk.gdk.PixbufAnimation</classname></link> 
to display</entry>
	    </row>

	    <row valign="top">
	      <entry>"pixel-size"</entry>
	      <entry>Read-Write</entry>

	      <entry>a fixed size overriding the "icon-size" property for
images of type <literal>gtk.IMAGE_ICON_NAME</literal>. Allowed values: >=
-1. Default value: -1. Available in GTK+ 2.6 and above.</entry>
	    </row>

	    <row valign="top">
	      <entry>"pixmap"</entry>
	      <entry>Read-Write</entry>
	      <entry>a <link
linkend="class-gdkpixmap"><classname>gtk.gdk.Pixmap</classname></link> to
display</entry>
	    </row>

	    <row valign="top">
	      <entry>"stock"</entry>
	      <entry>Read-Write</entry>
	      <entry>the stock ID for a stock image to display. Default
value: <literal>None</literal></entry>
	    </row>

	    <row valign="top">
	      <entry>"storage-type"</entry>
	      <entry>Read</entry>

	      <entry>the type of the image data; one of the <xref
linkend="gtk-image-type-constants"
endterm="gtk-image-type-constants-title"></xref>:
<literal>gtk.IMAGE_EMPTY</literal>, <literal>gtk.IMAGE_PIXMAP</literal>,
<literal>gtk.IMAGE_IMAGE</literal>, <literal>gtk.IMAGE_PIXBUF</literal>,
<literal>gtk.IMAGE_STOCK</literal>, <literal>gtk.IMAGE_ICON_SET</literal> or
<literal>gtk.IMAGE_ANIMATION</literal></entry>
	    </row>

	  </tbody>
	</tgroup>
      </informaltable>
    </blockquote>

  </refsect1>

  <refsect1 id="style-properties-gtkimage">
    <title>gtk.Image Style Properties</title>

    <para><link linkend="style-properties-gtkwidget">gtk.Widget Style Properties</link></para>

  </refsect1>

  <refsect1 id="signal-prototypes-gtkimage">
    <title>gtk.Image Signal Prototypes</title>

    <para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkobject">gtk.Object Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkwidget">gtk.Widget Signal Prototypes</link></para>
  </refsect1>

  <refsect1>
    <title>Description</title>

    <para>The <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> widget
displays an image. Various kinds of objects can be displayed as an image;
usually, you would load a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
("pixel buffer") from a file, and then display it. The convenience method
<link
linkend="method-gtkimage--set-from-file"><methodname>set_from_file</methodname>()</link> 
will read the file and automatically create a pixbuf that is added to the
<link linkend="class-gtkimage"><classname>gtk.Image</classname></link>
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 <link
linkend="function-gdk--pixbuf-new-from-file"><methodname>gtk.gdk.pixbuf_new_from_file</methodname>()</link>, 
then add it to the <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> with the
<link
linkend="method-gtkimage--set-from-pixbuf"><methodname>set_from_pixbuf</methodname>()</link> 
method. The image file may contain an animation; if so, the <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> will
display an animation (<link
linkend="class-gdkpixbufanimation"><classname>gtk.gdk.PixbufAnimation</classname></link>) 
instead of a static image.</para>

    <para><link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> is a
subclass of <link
linkend="class-gtkmisc"><classname>gtk.Misc</classname></link>, which
implies that you can align it (center, left, right) and add padding to it,
using the <link
linkend="class-gtkmisc"><classname>gtk.Misc</classname></link> methods.
<link linkend="class-gtkimage"><classname>gtk.Image</classname></link> is a
"no window" widget (has no <link
linkend="class-gdkwindow"><classname>gtk.gdk.Window</classname></link> 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 <link
linkend="class-gtkeventbox"><classname>gtk.EventBox</classname></link>, then
connect to the event signals on the event box.</para>

    <para>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 <link
linkend="class-gtkmisc"><classname>gtk.Misc</classname></link>). 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.</para>

    <para>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 <command>gdk-pixbuf-csource</command>. This program allows you to
convert an image into a C variable declaration, which can then be loaded
into a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link> using
the <link
linkend="function-gdk--pixbuf-new-from-inline"><function>gtk.gdk.pixbuf_new_from_inline</function>()</link>
function. This can also be used in <literal>PyGTK</literal> by modifying the
output using an editor or the <command>sed</command> command as
follows:</para>

    <programlisting>
  gdk-pixbuf-csource imagefile | \
          sed -n -e 's/{/[/' -e 's/};/]/' -e '/".*"/p' >outfile
</programlisting>

    <para>You can edit <filename>outfile</filename> into a Python file where
it will be evaluated to a list containing a string. The string can be used
directly with the <link
linkend="function-gdk--pixbuf-new-from-inline"><function>gtk.gdk.pixbuf_new_from_inline</function>()</link>
function to create a pixbuf that can be used in a <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link>.</para>

  </refsect1>

  <refsect1 id="constructor-gtkimage">
    <title>Constructor</title>

    <programlisting><constructorsynopsis language="python">
	<methodname>gtk.Image</methodname>
	<methodparam></methodparam>  </constructorsynopsis></programlisting>
    <variablelist>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>a newly created <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link>
widget.</simpara></listitem>
      </varlistentry>
    </variablelist>

    <para>Creates a new empty <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link>
widget.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtkimage--set-from-pixmap">
      <title>gtk.Image.set_from_pixmap</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_from_pixmap</methodname>
	  <methodparam><parameter
			 role="keyword">pixmap</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">mask</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">pixmap</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gdkpixmap"><classname>gtk.gdk.Pixmap</classname></link></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">mask</parameter>&nbsp;:</term>
	  <listitem><simpara>a bitmap <link
linkend="class-gdkpixmap"><classname>gtk.gdk.Pixmap</classname></link> or
<literal>None</literal></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_from_pixmap</methodname>() method sets the
image data from <parameter>pixmap</parameter> using
<parameter>mask</parameter>.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--set-from-image">
      <title>gtk.Image.set_from_image</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_from_image</methodname>
	  <methodparam><parameter
			 role="keyword">gdk_image</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">mask</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">gdk_image</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gdkimage"><classname>gtk.gdk.Image</classname></link> or
<literal>None</literal></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">mask</parameter>&nbsp;:</term>
	  <listitem><simpara>a bitmap <link
linkend="class-gdkpixmap"><classname>gtk.gdk.Pixmap</classname></link> or
<literal>None</literal></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_from_image</methodname>() method sets the
image data from <parameter>image</parameter> using
<parameter>mask</parameter>. A <link
linkend="class-gdkimage"><classname>gtk.gdk.Image</classname></link> is a
client-side image buffer in the pixel format of the current display. If
<parameter>image</parameter> is <literal>None</literal> the current image
data will be removed.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--set-from-file">
      <title>gtk.Image.set_from_file</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_from_file</methodname>
	  <methodparam><parameter
			 role="keyword">filename</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">filename</parameter>&nbsp;:</term>
	  <listitem><simpara>a filename or
<literal>None</literal></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_from_file</methodname>() method sets the
image data from the contents of the file named
<parameter>filename</parameter>. If the file isn't found or can't be loaded,
the resulting <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> will
display a "broken image" icon. This function never returns None, it always
returns a valid <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> widget. If
the file contains an animation, the image will contain an animation. If
<parameter>filename</parameter> is <literal>None</literal> the current image
data will be removed.</para>

      <para>If you need to detect failures to load the file, use <link
linkend="function-gdk--pixbuf-new-from-file"><methodname>gtk.gdk.pixbuf_new_from_file</methodname>()</link> 
to load the file yourself, then create the <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> from the
pixbuf. (Or for animations, use the <link
linkend="constructor-gdkpixbufanimation">gtk.gdk.PixbufAnimation</link>()
constructor.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--set-from-pixbuf">
      <title>gtk.Image.set_from_pixbuf</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_from_pixbuf</methodname>
	  <methodparam><parameter
			 role="keyword">pixbuf</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">pixbuf</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link> or
<literal>None</literal></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_from_pixbuf</methodname>() method sets the
image data using <parameter>pixbuf</parameter>. Note that this function just
creates an <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> from
<parameter>pixbuf</parameter>. The <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> created
will not react to state changes. Should you want that, you should use the
<link
linkend="method-gtkimage--set-from-icon-set"><methodname>set_from_icon_set</methodname>()</link> 
method If <parameter>pixbuf</parameter> is <literal>None</literal> the
current image data will be removed.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--set-from-stock">
      <title>gtk.Image.set_from_stock</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_from_stock</methodname>
	  <methodparam><parameter
			 role="keyword">stock_id</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">size</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">stock_id</parameter>&nbsp;:</term>
	  <listitem><simpara>a stock icon name</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">size</parameter>&nbsp;:</term>
	  <listitem><simpara>a stock icon size</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_from_stock</methodname>() method sets the
image data from the stock item identified by
<parameter>stock_id</parameter>. Sample stock icon names are
<literal>gtk.STOCK_OPEN</literal> and <literal>gtk.STOCK_OK</literal>.
Stock icon sizes are <literal>gtk.ICON_SIZE_MENU</literal>,
<literal>gtk.ICON_SIZE_SMALL_TOOLBAR</literal>,
<literal>gtk.ICON_SIZE_LARGE_TOOLBAR</literal>,
<literal>gtk.ICON_SIZE_BUTTON</literal>,
<literal>gtk.ICON_SIZE_DND</literal> and
<literal>gtk.ICON_SIZE_DIALOG</literal>. 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 <link
linkend="method-gtkiconfactory--add-default"><methodname>gtk.IconFactory.add_default</methodname>()</link> 
and <link
linkend="method-gtkiconfactory--add"><methodname>gtk.IconFactory.add</methodname>()</link> 
methods.</para>

      <para>The stock icons are described in the <link
linkend="gtk-stock-items">Stock Items</link> reference.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--set-from-icon-set">
      <title>gtk.Image.set_from_icon_set</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_from_icon_set</methodname>
	  <methodparam><parameter
			 role="keyword">icon_set</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">size</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">icon_set</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gtkiconset"><classname>gtk.IconSet</classname></link></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">size</parameter>&nbsp;:</term>
	  <listitem><simpara>a stock icon size</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_from_icon_set</methodname>() method sets the
image data from icon_set with the size specified by
<parameter>size</parameter>. Stock icon sizes are
<literal>gtk.ICON_SIZE_MENU</literal>,
<literal>gtk.ICON_SIZE_SMALL_TOOLBAR</literal>,
<literal>gtk.ICON_SIZE_LARGE_TOOLBAR</literal>,
<literal>gtk.ICON_SIZE_BUTTON</literal>,
<literal>gtk.ICON_SIZE_DND</literal> and
<literal>gtk.ICON_SIZE_DIALOG</literal>.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--set-from-animation">
      <title>gtk.Image.set_from_animation</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_from_animation</methodname>
	  <methodparam><parameter
			 role="keyword">animation</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">animation</parameter>&nbsp;:</term>
	  <listitem><simpara>the <link
linkend="class-gdkpixbufanimation"><classname>gtk.gdk.PixbufAnimation</classname></link></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_from_animation</methodname>() method sets
the image data from <parameter>animation</parameter>.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--get-storage-type">
      <title>gtk.Image.get_storage_type</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_storage_type</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the type of the image representation being
used</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_storage_type</methodname>() method gets the
type of representation being used by the <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> to store
image data. If the <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> has no
image data, the return value will be <literal>gtk.IMAGE_EMPTY</literal>. The
image type is one of: <literal>gtk.IMAGE_EMPTY</literal>,
<literal>gtk.IMAGE_PIXMAP</literal>, <literal>gtk.IMAGE_IMAGE</literal>,
<literal>gtk.IMAGE_PIXBUF</literal>, <literal>gtk.IMAGE_STOCK</literal>,
<literal>gtk.IMAGE_ICON_SET</literal> or
<literal>gtk.IMAGE_ANIMATION</literal>.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--get-pixmap">
      <title>gtk.Image.get_pixmap</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_pixmap</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a tuple containing the pixmap (or
<literal>None</literal>) and the mask (or
<literal>None</literal>)</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_pixmap</methodname>() method returns a tuple
containing the pixmap and mask being displayed by the <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link>. Either or
both the pixmap and mask may be <literal>None</literal>. If the storage type
of the image is not either <literal>gtk.IMAGE_EMPTY</literal> or
<literal>gtk.IMAGE_PIXMAP</literal> the ValueError exception will be
raised.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--get-image">
      <title>gtk.Image.get_image</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_image</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a tuple containing a <link
linkend="class-gdkimage"><classname>gtk.gdk.Image</classname></link> and a
mask bitmap</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_image</methodname>() method returns a tuple
containing the <link
linkend="class-gdkimage"><classname>gtk.gdk.Image</classname></link> and
mask being displayed by the <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link>. One or
both of the <link
linkend="class-gdkimage"><classname>gtk.gdk.Image</classname></link> and
mask may be <literal>None</literal>. If the storage type of the image is not
either of <literal>gtk.IMAGE_EMPTY</literal> or
<literal>gtk.IMAGE_IMAGE</literal> the ValueError exception will be
raised.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--get-pixbuf">
      <title>gtk.Image.get_pixbuf</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_pixbuf</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the displayed pixbuf, or
<literal>None</literal> if the image is empty</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_pixbuf</methodname>() method gets the <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link> being
displayed by the <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link>. The return
value may be None if no image data is set. If the storage type of the image
is not either <literal>gtk.IMAGE_EMPTY</literal> or
<literal>gtk.IMAGE_PIXBUF</literal> the ValueError exception will be
raised.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--get-stock">
      <title>gtk.Image.get_stock</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_stock</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a tuple containing the stock icon name and the
stock icon size of the image data</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_stock</methodname>() method returns a tuple
containing the stock icon identifier (may be <literal>None</literal>) and
size being displayed by the <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link>. The size
will be one of: <literal>gtk.ICON_SIZE_MENU</literal>,
<literal>gtk.ICON_SIZE_SMALL_TOOLBAR</literal>,
<literal>gtk.ICON_SIZE_LARGE_TOOLBAR</literal>,
<literal>gtk.ICON_SIZE_BUTTON</literal>,
<literal>gtk.ICON_SIZE_DND</literal> or
<literal>gtk.ICON_SIZE_DIALOG</literal>. If the storage type of the image is
not either <literal>gtk.IMAGE_EMPTY</literal> or
<literal>gtk.IMAGE_STOCK</literal> the ValueError exception will be
raised.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--get-icon-set">
      <title>gtk.Image.get_icon_set</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_icon_set</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a tuple containing a <link
linkend="class-gtkiconset"><classname>gtk.IconSet</classname></link> and a
stock icon size</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_icon_set</methodname>() method returns a
tuple containing the icon set (may be <literal>None</literal>) and size
being displayed by the <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link>. The size
will be one of: <literal>gtk.ICON_SIZE_MENU</literal>,
<literal>gtk.ICON_SIZE_SMALL_TOOLBAR</literal>,
<literal>gtk.ICON_SIZE_LARGE_TOOLBAR</literal>,
<literal>gtk.ICON_SIZE_BUTTON</literal>,
<literal>gtk.ICON_SIZE_DND</literal> or
<literal>gtk.ICON_SIZE_DIALOG</literal>. If the storage type of the image is
not either <literal>gtk.IMAGE_EMPTY</literal> or
<literal>gtk.IMAGE_ICON_SET</literal> the ValueError exception will be
raised.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--get-animation">
      <title>gtk.Image.get_animation</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_animation</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the displayed animation, or
<literal>None</literal> if the image is empty</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_animation</methodname>() method gets the
<link
linkend="class-gdkpixbufanimation"><classname>gtk.gdk.PixbufAnimation</classname></link> 
(may be None if there is no image data) being displayed by the <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link>. If the
storage type of the image is not either <literal>gtk.IMAGE_EMPTY</literal>
or <literal>gtk.IMAGE_ANIMATION</literal> the ValueError exception will be
raised.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--get-icon-name">
      <title>gtk.Image.get_icon_name</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_icon_name</methodname>
        </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a 2-tuple containing the name and size of the
displayed icon.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.6 and above.</para>
      </note>

      <para>The <methodname>get_icon_name</methodname>() method returns a
2-tuple containing the values of the "icon-name" and "icon-size" properties
respectively if the "icon-name" property is not <literal>None</literal>. If
the "icon-name" property is <literal>None</literal> the 2-tuple returned
will be:</para>

      <programlisting>
  (None, &lt;enum GTK_ICON_SIZE_INVALID of type GtkIconSize&gt;)
</programlisting>

    </refsect2>

    <refsect2 id="method-gtkimage--set-from-icon-name">
      <title>gtk.Image.set_from_icon_name</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_from_icon_name</methodname>
          <methodparam><parameter
                         role="keyword">icon_name</parameter></methodparam>
          <methodparam><parameter
                         role="keyword">size</parameter></methodparam>
        </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">icon_name</parameter>&nbsp;:</term>
	  <listitem><simpara>an icon name</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">size</parameter>&nbsp;:</term>
	  <listitem><simpara>a stock icon size</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.6 and above.</para>
      </note>

      <para>The <methodname>set_from_icon_name</methodname>() method sets
the "icon-name" and "icon-size" properties to the values of
<parameter>icon_name</parameter> and <parameter>size</parameter>
respectively. <parameter>icon_name</parameter> should be the name of an icon
in the current icon theme. If <parameter>icon_name</parameter> isn't known,
a "broken image" icon will be displayed instead. If the current icon theme
is changed, the icon will be updated appropriately.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--set-pixel-size">
      <title>gtk.Image.set_pixel_size</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_pixel_size</methodname>
          <methodparam><parameter
                         role="keyword">pixel_size</parameter></methodparam>
        </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">pixel_size</parameter>&nbsp;:</term>
	  <listitem><simpara>the new pixel size to be used for named
icons</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.6 and above.</para>
      </note>

      <para>The <methodname>set_pixel_size</methodname>() method sets the
"pixel-size" property to the value specified by
<parameter>pixel_size</parameter>. If the pixel size is set to a value != -1
the "pixel-size" property is used instead of the icon size set by the <link
linkend="method-gtkimage--set-from-icon-name"><methodname>set_from_icon_name</methodname>()</link>
method.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--get-pixel-size">
      <title>gtk.Image.get_pixel_size</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_pixel_size</methodname>
        </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the pixel size used for named
icons.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.6 and above.</para>
      </note>

      <para>The <methodname>get_pixel_size</methodname>() method returns the
value of the "pixel-size" property which specifies the pixel size to be used
for named icons.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--clear">
      <title>gtk.Image.clear</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>clear</methodname>
        </methodsynopsis></programlisting>

      <note>
        <para>This method is available in PyGTK 2.8 and above.</para>
      </note>

      <para>The <methodname>clear</methodname>() 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.</para>

    </refsect2>

    <refsect2 id="method-gtkimage--set-from-gicon">
      <title>gtk.Image.set_from_gicon</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_from_gicon</methodname>
          <methodparam><parameter role="keyword">icon</parameter></methodparam>
          <methodparam><parameter role="keyword">size</parameter></methodparam>
        </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">icon</parameter>&nbsp;:</term>
	  <listitem><simpara>an icon</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">size</parameter>&nbsp;:</term>
	  <listitem><simpara>an icon size</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.14 and above.</para>
      </note>

      <para>
	For the <methodname>set_from_gicon</methodname>() method see
	<methodname><link linkend="function-gtk--image-new-from-gicon">gtk.image_new_from_gicon</link></methodname>()
	for details.
      </para>

    </refsect2>

  </refsect1>

  <refsect1>
    <title>Functions</title>

    <refsect2 id="function-gtk--image-new-from-stock">
      <title>gtk.image_new_from_stock</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.image_new_from_stock</methodname>
	  <methodparam><parameter
			 role="keyword">stock_id</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">size</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">stock_id</parameter>&nbsp;:</term>
	  <listitem><simpara>a stock icon name</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">size</parameter>&nbsp;:</term>
	  <listitem><simpara>an integer representing an icon
size</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
	  linkend="class-gtkimage"><classname>gtk.Image</classname></link>
	  displaying the stock icon</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.image_new_from_stock</function>() function
returns a new <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> displaying
the stock icon specified by <parameter>stock_id</parameter> with the
specified <parameter>size</parameter>. Sample stock icon names are
<literal>gtk.STOCK_OPEN</literal>, <literal>gtk.STOCK_OK</literal> - see the
<link
linkend="method-gtkimage--set-from-stock"><methodname>set_from_stock</methodname>()</link> 
method for detailed information on the <literal>PyGTK</literal> stock icons.
. Sample stock sizes are <literal>gtk.ICON_SIZE_MENU</literal>,
<literal>gtk.ICON_SIZE_SMALL_TOOLBAR</literal> - see the <link linkend="function-gtk--icon-size-lookup"><function>gtk.icon_size_lookup</function>()</link> 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 <link
linkend="method-gtkiconfactory--add-default"><methodname>gtk.IconFactory.add_default</methodname>()</link> 
and <link
linkend="method-gtkiconfactory--add"><methodname>gtk.IconFactory.add</methodname>()</link> 
methods.</para>

    </refsect2>

    <refsect2 id="function-gtk--image-new-from-icon-set">
      <title>gtk.image_new_from_icon_set</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.image_new_from_icon_set</methodname>
	  <methodparam><parameter
			 role="keyword">icon_set</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">size</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">icon_set</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gtkiconset"><classname>gtk.IconSet</classname></link>
object</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">size</parameter>&nbsp;:</term>
	  <listitem><simpara>an integer representing an icon
size</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link>
object</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.image_new_from_icon_set</function>() function
returns a new <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> created
from the <link
linkend="class-gtkiconset"><classname>gtk.IconSet</classname></link>
specified by <parameter>icon_set</parameter> with the specified
<parameter>size</parameter>. Sample stock sizes are
<literal>gtk.ICON_SIZE_MENU</literal>,
<literal>gtk.ICON_SIZE_SMALL_TOOLBAR</literal> - see the <link
linkend="function-gtk--icon-size-lookup"><function>gtk.icon_size_lookup</function>()</link> 
function for more detail. Instead of using this function, usually it's
better to create a <link
linkend="class-gtkiconfactory"><classname>gtk.IconFactory</classname></link>, 
put your icon sets in the icon factory, add the icon factory to the list of
default factories with the <link
linkend="method-gtkiconfactory--add-default"><methodname>add_default</methodname>()</link> 
method, and then use the <link
linkend="function-gtk--image-new-from-stock"><function>gtk.image_new_from_stock</function>()</link> 
function. This will allow themes to override the icon you ship with your
application.</para>

    </refsect2>

    <refsect2 id="function-gtk--image-new-from-animation">
      <title>gtk.image_new_from_animation</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.image_new_from_animation</methodname>
	  <methodparam><parameter
			 role="keyword">animation</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">animation</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gdkpixbufanimation"><classname>gtk.gdk.PixbufAnimation</classname></link> 
object</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link>
object</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.image_new_from_animation</function>() function
returns a new <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> object
containing the <link
linkend="class-gdkpixbufanimation"><classname>gtk.gdk.PixbufAnimation</classname></link> 
specified by <parameter>animation</parameter>.</para>

    </refsect2>

    <refsect2 id="function-gtk--image-new-from-icon_name">
      <title>gtk.image_new_from_icon_name</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.image_new_from_icon_name</methodname>
	  <methodparam><parameter
			 role="keyword">icon_name</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">size</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">icon_name</parameter>&nbsp;:</term>
	  <listitem><simpara>an icon name</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">size</parameter>&nbsp;:</term>
	  <listitem><simpara>a stock icon size</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link>
widget.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This function is available in PyGTK 2.6 and above.</para>
      </note>

      <para>The <function>gtk.image_new_from_icon_name</function>() function
returns a new <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> object
displaying the named theme icon specified by
<parameter>icon_name</parameter> with the icon size specified by
<parameter>size</parameter>. 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.</para>

    </refsect2>
    
    <refsect2 id="function-gtk--image-new-from-pixmap">
      <title>gtk.image_new_from_pixmap</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.image_new_from_pixmap</methodname>
	  <methodparam><parameter
			 role="keyword">pixmap</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">mask</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">pixmap</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gdkpixmap"><classname>gtk.gdk.Pixmap</classname></link></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">mask</parameter>&nbsp;:</term>
	  <listitem><simpara>the bitmap that is the transparency mask.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link>
widget.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This function is available in PyGTK 2.12 and above.</para>
      </note>

      <para>The <function>gtk.image_new_from_pixmap</function>() function
returns a new <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> object
displaying pixmap with a mask. A <link
linkend="class-gdkpixmap"><classname>gtk.gdk.Pixmap</classname></link> 
is a server-side image buffer in the pixel format of the current display.</para>

    </refsect2>
    
    <refsect2 id="function-gtk--image-new-from-image">
      <title>gtk.image_new_from_image</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.image_new_from_image</methodname>
	  <methodparam><parameter
			 role="keyword">image</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">mask</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">image</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gdkimage"><classname>gtk.gdk.Image</classname></link></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">mask</parameter>&nbsp;:</term>
	  <listitem><simpara>the bitmap that is the transparency mask.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link>
widget.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This function is available in PyGTK 2.12 and above.</para>
      </note>

      <para>The <function>gtk.image_new_from_image</function>() function
returns a new <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> object
displaying an image with a mask. A <link
linkend="class-gdkimage"><classname>gtk.gdk.Image</classname></link> 
is a client-side image buffer in the pixel format of the current display.</para>

    </refsect2>
    
    <refsect2 id="function-gtk--image-new-from-file">
      <title>gtk.image_new_from_file</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.image_new_from_file</methodname>
	  <methodparam><parameter
			 role="keyword">filename</parameter></methodparam>
	  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">filename</parameter>&nbsp;:</term>
	  <listitem><simpara>a filename</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link>
widget.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This function is available in PyGTK 2.12 and above.</para>
      </note>

      <para>The <function>gtk.image_new_from_file</function>() function
returns a new <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> object
displaying the file filename. If the file isn't found or can't be loaded, 
the resulting <link linkend="class-gtkimage"><classname>gtk.Image</classname></link> 
will display a "broken image" icon. This function never returns None, 
it always returns a valid <link linkend="class-gtkimage"><classname>gtk.Image</classname>
</link> widget.</para>
      <para>If the file contains an animation, the image will contain an animation.</para>
      <para>If you need to detect failures to load the file, use <link
linkend="function-gdk--pixbuf-new-from-file">gtk.gdk.pixbuf_new_from_file</link> 
to load the file yourself, then create the <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> 
from the pixbuf. (Or for animations, use <link
linkend="constructor-gdkpixbufanimation">gtk.gdk.PixbufAnimation</link>.
The storage type (<link
linkend="method-gtkimage--get-storage-type">get_storage_type</link>) 
of the returned image is not defined, it will be whatever is appropriate 
for displaying the file.</para>

    </refsect2><refsect2 id="function-gtk--image-new-from-pixbuf">
      <title>gtk.image_new_from_pixbuf</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.image_new_from_pixbuf</methodname>
	  <methodparam><parameter
			 role="keyword">pixbuf</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">pixbuf</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
	  </simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link>
widget.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This function is available in PyGTK 2.12 and above.</para>
      </note>

      <para>The <function>gtk.image_new_from_pixbuf</function>() function
returns a new <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> object
displaying pixbuf</para>
      <para>Note that this function just creates a <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> from the pixbuf. The 
<link linkend="class-gtkimage"><classname>gtk.Image</classname></link> 
created will not react to state changes. Should you want that, you should use 
<link linkend="function-gtk--image-new-from-icon-set">gtk.image_new_from_icon_set</link>
      </para>
     </refsect2>
    
    <refsect2 id="function-gtk--image-new-from-gicon">
      <title>gtk.image_new_from_gicon</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.image_new_from_gicon</methodname>
	  <methodparam><parameter role="keyword">gicon</parameter></methodparam>
	  <methodparam><parameter role="keyword">size</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">gicon</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link linkend="class-gioicon"><classname>gio.Icon</classname></link>
	  </simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">size</parameter>&nbsp;:</term>
	  <listitem><simpara>a stock icon size.
	  </simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link linkend="class-gtkimage"><classname>gtk.Image</classname></link>
	  displaying the themed icon.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This function is available in PyGTK 2.14 and above.</para>
      </note>

      <para>The <function>gtk.image_new_from_pixbuf</function>() function returns
      a new <link linkend="class-gtkimage"><classname>gtk.Image</classname></link>
      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.
      </para>
     </refsect2>
 

  </refsect1>

</refentry>