An Introduction to Tkinter
前页 | Chapter 36. The PhotoImage Class | 后页

# Options

The `PhotoImage` class supports the following options.

Table 36-2. PhotoImage Options

Option | Type | Description
--- | --- | ---
`file` | string | Read image data from the given file. The file can contain GIF, PGM (grayscale), or PPM (truecolor) data. Transparent regions in the GIF file are made transparent. To handle other file formats, use the corresponding class in the Python Imaging Library.
`data` | string | Read image data from a string. In the current version of Tk, this only works for base64-encoded GIF files. If the `file` option is given, this option is ignored.
`width, height` | integer | The width (height) of the image memory. Note that this is the requested size, not the actual size. To get the actual size, use the corresponding methods.
`format` | string | If several file handlers can handle the given file, this option can be used to specify which handler to use. If you haven't installed extra file handlers, there's no need to use this option.
`gamma` | float | The image gamma. To get fully accurate colors, this should be set to a combination of the gamma values for the image and display. Default is 1.0 (no gamma correction).
`palette` | integer or string | Specifies the number of palette entries to use when displaying this image. You can either use a single integer to display the image as a grayscale image with that number of grayscale levels, or a string with three numbers separated by slashes, to display the image as a color image with that number of red, green, and blue values. The default is system specific.

前页 | Home | 后页
Methods | Up | The Place Geometry Manager