[ltk-user] Icons

Bill Ramsay ramsayw1 at verizon.net
Fri Aug 18 15:17:27 UTC 2006


Felip Alàez Nadal wrote:
> The first paramether is a photo object. You can see an example of how 
> to load an image at the source code for cl-cbr: 
> http://common-lisp.net/project/nixies/download/clcbr_latest.tar.gz 
> <http://common-lisp.net/project/nixies/download/clcbr_latest.tar.gz>
>  
> But to add an image to a button you only have to pass Its name as a 
> paramether when creating It. If the image isn't in a valid format, Ltk 
> don't loads It. You can use convert, which is part of ImageMagick, to 
> convert images to ppm.
>
>  
> 2006/8/16, Bill Ramsay <ramsayw1 at verizon.net 
> <mailto:ramsayw1 at verizon.net>>:
>
>     I'm trying to add an image or icon to a menubutton (or regular button)
>     and I don't quite get how it works.
>
>     What does the first parameter of image-load represent  (i.e. photo
>     as in
>     (image-load photo "x.ppm"))?
>     Should I be working with bitmaps instead of images?
>     How does the result of the load get assigned to the widget?
>     And how does the :anchor or :justify get placed on the icon as opposed
>     to the button text or the button itself?
>
>     Is there an example of this anywhere?
>
>     Thanks,
>
>     Bill
>     _______________________________________________
>     ltk-user site list
>     ltk-user at common-lisp.net <mailto:ltk-user at common-lisp.net>
>     http://common-lisp.net/mailman/listinfo/ltk-user
>
>
>
>
> -- 
> Felip Alàez Nadal
> ------------------------------------------------------------------------
>
> _______________________________________________
> ltk-user site list
> ltk-user at common-lisp.net
> http://common-lisp.net/mailman/listinfo/ltk-user
I'm sorry, but I'm missing something here.....

What I'm trying to do is create a square tool button with a graphic in 
the middle of it.   Nothing special.

I seem to have a number of ways of doing this:

1)   Ideally, I would just add the filepath to the graphic to the :image 
parameter when I create the button (i.e :image (directory "x.ppm")   
This compiles, but gives me a LTK::NAME error when I run it.   

2)  I can try MAKE-IMAGE to create a photo-image and then use IMAGE-LOAD 
(i.e. :image (image-load photo (directory "x.ppm")) this will compile 
but not run.   I get a TWO-WAY-STREAM error for descriptors 7 and 6.

3)  If I do the same as 2, but not use "directory" it compiles and runs, 
but there's no image

4) If I do the same as 2, but use MAKE-INSTANCE to create a photo-image, 
it compiles and runs, but there is no image

I know that in X you have to create a window as the place to draw the 
loading image and then move or copy the image to the place you want to 
put it.    Isn't that what's happening when you MAKE-IMAGE and then use 
IMAGE-LOAD.   (I don't quite see how this affects the :image assignment 
for the button).

I'm sure this is not difficult to do, but everything I try fails.    
What I would like to see is the code for toolbutton with an image in the 
middle that works.     The example you refered me to wasn't quite the 
same thing.

Sorry for the long reply...

Bill



More information about the ltk-user mailing list