Thread [Tk] Icons und Images in externe Datei auslagern (XPM-Format) (11 answers)
Opened by Kean at 2014-08-07 13:43

Kean
 2014-08-07 15:55
#176767 #176767
User since
2004-08-18
463 Artikel
BenutzerIn

user image
Ich habe mal mit einem eigenen Modul getestet. Der Code sieht wie folgt aus:

Code: (dl )
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
package Icons;

our $arrow_small_green = <<'END';
/* XPM */
static char *arrow_small[] = {
/* columns rows colors chars-per-pixel */
"19 17 37 1",
" c #04B04F",
". c #0BB04F",
"X c #16B24F",
"o c #1AB24F",
"O c #04AF50",
"+ c #00AF5D",
"@ c #00B050",
"# c #01B050",
"$ c #02B050",
"% c #00B052",
"& c #01B052",
"* c #04B050",
"= c #00B056",
"- c #00B157",
"; c #0AB150",
": c #02B15B",
"> c #00B25D",
", c #04B35F",
"< c #16B250",
"1 c #1DB553",
"2 c #20B44F",
"3 c #21B452",
"4 c #21B55F",
"5 c #3CB955",
"6 c #00B061",
"7 c #00B46F",
"8 c #08B569",
"9 c #0AB66E",
"0 c #1FB968",
"q c #00B470",
"w c #07B670",
"e c #00B677",
"r c #0EB87A",
"t c #4AB955",
"y c #17BC92",
"u c #1EC197",
"i c None",
/* pixels */
"iiiiiiiiiiiiiiiii<y",
"iiiiiiiiiiiiiii5@>i",
"iiiiiiiiiiiiii1@7ii",
"iiiiiiiiiiiii.@qiii",
"iiiiiiiiiiii @6iiii",
"iiiiiiiiiiiO@8iiiii",
"iiiiiiiiii*@:iiiiii",
"iiiiiiiii;@=iiiiiii",
"iiiiiiiiO@@uiiiiiii",
"i<@@iiio@@wiiiiiiii",
"i@@@,it@@6iiiiiiiii",
"ii@@@0@ @iiiiiiiiii",
"iio@@@@ riiiiiiiiii",
"iii*@@@:iiiiiiiiiii",
"iii3@@@eiiiiiiiiiii",
"iiii@@9iiiiiiiiiiii",
"iiii4iiiiiiiiiiiiii"
};
END

1;


Und eingebunden habe ich ihn ganz normal mit:
Code: (dl )
use Icons;


Darauf zugreifen tue ich über:
Code: (dl )
$hlist->itemCget($y, $x, -widget)->Photo(-data => $Icons::arrow_small_green, -format => 'xpm');


Wenn in dem Modul noch mehr Images hinzu kommen, werden diese dann alle beim Programmstart geladen? Sind also die ganze Zeit im Ramspeicher? Oder nur wenn ich eins lade?

View full thread [Tk] Icons und Images in externe Datei auslagern (XPM-Format)