16.1.6.9 Images

Python 2.2

16.1.6.9 Images

Bitmap/Pixelmap images can be created through the subclasses of Tkinter.Image:

  • BitmapImage can be used for X11 bitmap data.
  • PhotoImage can be used for GIF and PPM/PGM color bitmaps.

Either type of image is created through either the file or the data option (other options are available as well).

The image object can then be used wherever an image option is supported by some widget (e.g. labels, buttons, menus). In these cases, Tk will not keep a reference to the image. When the last Python reference to the image object is deleted, the image data is deleted as well, and Tk will display an empty box wherever the image was used.

See About this document... for information on suggesting changes.