From: Geoff B. <ge...@mr...> - 2006-05-04 12:07:29
|
Hi, I have encountered an unusual problem. Using TkImg to display png images on widgets, I have found that certain images will not display on buttons, despite being displayed correctly on labels. This does not occur for all pngs. Here is some example code to illustrate the problem: package require Img 1.3 image create photo file16x16 -data "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QAAAB5AACiY+igAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1gQNDQMUNnY/YgAAAB10RVh0Q29tbWVudABDcmVhdGVkIHdpdGggVGhlIEdJTVDvZCVuAAABLklEQVQ4y42Tv0rEQBDGfzlU7iV8BgvRQq44JVpZ3psIVoKYysexsNATJRwcWNpcZ2thJ4p/bkPms0hu3ezF6MDshGHmy3zfziYAw5FEbVKBrMCsQKqjOcwK9gZ9zk/WE2IbjqQvVf4p6UPSu6Q3Sa+SXiRtHcy0mT7o+OxRYW+v/q8/BRhQ1tG7Oa5vNhjnzxydztQAMJv7wqXGBag50t0pVjrGd09MJhMBrAAVR/qNKcJpBFzdbvvv/cEleX6PBzBzjeKw2SIgA6x0XgMPEBeqpVkBnV8BukB8PgZQRMFaaBAJ2pygdJ3NS3n7hwbWoUMrQDyuujRp06DsuMKFly0T9AgSatvAYEMVrHVEYU66cxG9wKKiZgUWvtA6wuoPwGx6mGRZJv60BFirvbJvHho7WU00oXsAAAAASUVORK5CYII=" image create photo disk16x16 -data "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1gEKETQfcairAwAAAB10RVh0Q29tbWVudABDcmVhdGVkIHdpdGggVGhlIEdJTVDvZCVuAAABHklEQVQ4y62TPU7DQBBG33gtD61vgFL4AtyAmjaRoIY0iJJ+kbgCTRoKCqTkApwllzBSikhkxkvh2FJIAEcwW+ysdufpm5+FP5oAVGWcA+Mj4hbLOk76U1XGdDFK6WKUUv1ep9Vqldbrddp8bFJqmtRZ96YqY5pOp3OA/CvazZEkCCACOOR5fkjF+CDAzNpI7wiCiBBCOJjLvgJvkMwQAXFp9+2CbAjAdoJEBMRaRRQDAI0jLr38rlfS+b8B7s5Pj5qDPcDV4yuqihYFeqIUqmih5HlOnJwNq8Hz/SUAt09vZMEJmQ3vgpnt+CEELGQEHwpwZxJfUFXcFAstxIP/CFgs64cxwM11/LZgVdnfLbpJ7Huzne3BH2o2mwn/YZ88Om+hLP9jrQAAAABJRU5ErkJggg==" label .file_label -image file16x16 label .disk_label -image disk16x16 button .file_button -image file16x16 button .disk_button -image disk16x16 grid .file_label .disk_label grid .file_button .disk_button The png image "file16x16" displays correctly on labels and buttons, but "disk16x16" only displays on the label, with the button being blank (but sized correctly for a 16x16 image). The problem remains when png files are used rather than png image data as a string. This problem occurs under Aqua using tk 8.4.11 with TkImg 1.3. I have also reproduced this with tk 8.4.13 (same TkImg installation). On another machine with tk 8.4.7 the test script actually causes a segmentation fault: usr/bin/wish8.4: line 2: 3095 Segmentation fault "$(dirname $0)/../../System/Library/Frameworks/Tk.framework/Versions/8.4/Resources/Wish Shell.app/Contents/MacOS/Wish Shell" "$@" The above script displays all images as expected using tk 8.4.11 on linux, and using tk 8.4.1 under X11 on Mac Os X. I'd be interested to hear if anyone else gets the same results, or has any suggestions for a workaround. Also, if anyone can identify exactly what it is about the disk16x16 png that causes it to fail while file16x16 works (I have several other examples of working and failing images), then I would love to hear about it! I posted to comp.lang.tcl but have had no replies saying they also had a problem. I had one reply saying it worked fine, but I'm not sure which version of tk that was with. http://groups.google.co.uk/group/comp.lang.tcl/tree/browse_frm/thread/a5194f85d94e0c4e/bcc9dbddb4b9773e?rnum=1&q=png+mac+os+x&_done=%2Fgroup%2Fcomp.lang.tcl%2Fbrowse_frm%2Fthread%2Fa5194f85d94e0c4e%2F8d004bf24fdd0c60%3Fq%3Dpng+mac+os+x%26rnum%3D1%26#doc_bcc9dbddb4b9773e Thanks in advance for any replies, Geoff. |