Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Usage of *.xpm pics and *.gif in icons is it possible? 1

Status
Not open for further replies.

firelex

Programmer
Jan 10, 2002
118
0
0
DE
Hello, all!
My question is:
Is it possible to use somehow the *.xpm pics in TCL?
The possibilities, I've found were only *.bmp and *.gif.
It's not so much...
And the second question:
In icons it is possible to use ONLY *.bmp's. Is it right?
Can I use at least *.gif there?

Thanks.
 
The photo Tk manual page says:
Code:
At present, only GIF and PPM/PGM formats are supported, but an interface exists to allow additional image file formats to be added easily

But you can use the Img package.
From its site:
Code:
This package enhances Tk, adding support for many other Image formats: BMP, XBM, XPM, GIF (with transparency, but without LZW), PNG, JPEG, TIFF and postscript. The main library is libimg1.2.so (libimg1.2.sl, libimg1.2.a, img12.dll), which handles the BMP, XBM, XPM, GIF formats and the Pixmap image type. This library can be loaded dynamically into Tcl/Tk. If these formats are all you need, no other libraries need to be installed.

Using the Img package is matter of adding:
Code:
  package require Img
with the current Tk distributions.

For the icons, its another story.
From the winfo Tk manual page:
Code:
wm iconbitmap window ?bitmap? 
If bitmap is specified, then it names a bitmap in the standard forms accepted by Tk (see the Tk_GetBitmap manual entry for details). This bitmap is passed to the window manager to be displayed in window's icon, and the command returns an empty string. If an empty string is specified for bitmap, then any current icon bitmap is cancelled for window. If bitmap is specified then the command returns an empty string. Otherwise it returns the name of the current icon bitmap associated with window, or an empty string if window has no icon bitmap. On the Windows operating system, an additional flag is supported: wm iconbitmap window ?-default? ?image?. If the -default flag is given, the icon is applied to all toplevel windows (existing and future) to which no other specific icon has yet been applied. In addition to bitmap image types, a full path specification to any file which contains a valid Windows icon is also accepted (usually .ico or .icr files), or any file for which the shell has assigned an icon. Tcl will first test if the file contains an icon, then if it has an assigned icon, and finally, if that fails, test for a bitmap.

Personaly, on Windows, I only succeeded with the .ico files.

HTH

ulis

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top