[ltk-user] Problem with Extension

Peter Herth herth at peter-herth.de
Wed Apr 1 22:43:44 UTC 2009


Hi Christoph,

if you want to refer to widgets on the tk-side you usually want to
pass (widget-path widget).
Other than that I don't see an obvious mistake without trying it out
myself (on travel atm.)
But have you tried to use the ltk functions for images as make-image
and image-load?
Last time I tried, they worked for me. If that all does not help, set
ltk:*debug-tk* to true and post the output it generates, which should
allow us to see much better what goes wrong.

Peter

On Wed, Apr 1, 2009 at 11:19 PM, Christoph Senjak
<christoph.senjak at googlemail.com> wrote:
> 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
>
> _______________________________________________
> ltk-user site list
> ltk-user at common-lisp.net
> http://common-lisp.net/mailman/listinfo/ltk-user
>




More information about the ltk-user mailing list