Hello.
I want to use PNG-Images on Ltk-Buttons. Therefore, I want to use the Img-Package. I am not familiar with this. I read the documentation and tried the following:
(setf *init-wish-hook* (append
*init-wish-hook*
(list (lambda ()
(send-wish "package require Img")))))
(defun config-button-png (button png)
(format-wish "~A configure -image [ image create photo -data \"~A\" ]"
(ltk::name button)
png))
(with-ltk ()
(let* ((f (make-instance 'frame))
(b (make-instance 'button
:master f
:text ""
:command (lambda () (format t "Quak!~%")))))
(pack f)
(config-button-png b "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9kEARQbItOgpzAAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAEklEQVQY02P8z4APMDGMSmMBAEEsARNlYhAzAAAAAElFTkSuQmCC")
(pack b)))
This doesnt work. Also when replacing -data by -file and providing a filename, it doesnt work. I also tried to replace ltk::name by ltk::widget-path.
There is no Image appearing. In the wish-shell, the following works:
package require Img
set frame .frame
toplevel $frame
frame $frame.f
button $frame.f.b -text ""
$frame.f.b configure -image [ image create photo -data "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9kEARQbItOgpzAAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAEklEQVQY02P8z4APMDGMSmMBAEEsARNlYhAzAAAAAElFTkSuQmCC" ]
Do you have any clue what I am doing wrong?
Thank You.
Christoph Senjak