24bit display on Unix machine

Fredrik Lundh fredrik at pythonware.com
Sat Apr 28 09:50:25 EDT 2001


Nickson Fong wrote:

> How can i display a 24bit image in Python Tkinter(Unix)?

for the basics, see my earlier post on Tkinter jpeg/gif display.

if the image is displayed with 256 colours also on a 24-bit display,
you have to specify create a truecolor toplevel window:

    top = Toplevel(root, visual="truecolor")

    w = Label(top, image=myimage)
    w.pack()


more info from "an introduction to tkinter":

    "[The visual option] controls the "visual" type to use for
    this window. This option should usually be omitted. In
    that case, the visual type is inherited from the root window.

    Some more advanced displays support "mixed visuals". This
    typically means that the root window is a 256-color display
    (the "pseudocolor" visual type), but that individual windows
    can be displayed as true 24-bit color (the "truecolor" visual
    type). On such displays, you may wish to explicitly set the
    visual option to "truecolor" for any windows used to display
    full-color images.

    Other possible values include "directcolor", "staticcolor",
    "grayscale", or "staticgray". See your X window documentation
    for details.

    You cannot change this option once you've created the
    window.

    quoted from:
    http://www.pythonware.com/library/tkinter/introduction/toplevel.htm

> centropolisfx

ilm, weta, centropolis.  I think we have a trend here ;-)

Cheers /F





More information about the Python-list mailing list