Updated 2013-07-13 20:14:48 by paul

Summary  edit

Documentation  edit

man page
Tk_GetBitmap man page

See Also  edit

[How to edit an executable's desktop icon]
Bitmap Editor
a simple tool to create and edit bitmaps
poSoft utilities, by Paul Obermeier, is an editor for X bitmaps
Bitmap editor, by Ian Gay
Tk syntax help
Arts and crafts of Tcl-Tk programming
bitmap images with 2 colors and transparency

Description  edit

A bitmap is monochromatic representation.

Use a photo image when you want color or greyscale images or icons (aka a pixmap).

Tk uses bitmaps in two senses: directly (via various widgets' -bitmap options) and indirectly through the bitmap image type. They are different! Bitmap images are, first and foremost, images. Naked bitmaps are distinctly uncommon, as well as being difficult to work with in practice. (AMG: Naked photos, on the other hand... hehehe.)

If you want to edit the bitmap image, it's easier to use a photo with just two colors.

A variant Tk-pertinent sense of "bitmap" is as a permissible argument to specific canvas subcommands. A model of such uses is
.canvas itemconfig rectangle -stipple $bitmap

Along with much else Tk_GetBitmap provides a list--"error", "gray50", "question", and so on--of standard bitmaps built in to Tk. Apparently Tk provides no script-level introspection to access this list. To view these built-ins, therefore, it's necessary to perform something like the script below. Note, however, that the last 16 bitmaps (from document to caution) are only available on the Mac platform.
set bitmap_list {error gray75 gray50 gray25 gray12 hourglass
    info questhead question warning document stationery edition
    application accessory folder pfolder trash floppy ramdisk
    cdrom preferences querydoc stop note caution}

eval destroy [winfo children .]

canvas .c -height 200 -width 200 -background linen
listbox .l -height [llength $bitmap_list]

foreach bitmap $bitmap_list {
    .l insert end $bitmap
pack .c .l -fill x

bind .l <ButtonRelease-1> show_bitmap

proc show_bitmap {} {
    set pattern [.l get [.l curselection]]
    .c delete bitmap
    .c create bitmap 100 100 -bitmap $pattern -tags bitmap

Run this and you'll see such pictures as ...