Drawing Images -- X Python Reference Manual

Next: Drawing Text Prev: Drawing Up: Drawing Top: Top

## 1.2.1. Drawing Images

An image (pixmap) can be drawn by using the GC method `PutImage`. This method requires an Image object which can be created using the Visual Info method `CreateImage`. The only way to get a Visual Info object is by using the widget method `GetVisualInfo` which returns a list of Visual Info objects.

For example (`picture` is a string object that contains an image in the correct format for the call to CreateImage, see the manual for more information):

        visual = w.DefaultVisualOfScreen()
        image = visual.CreateImage(depth, X.ZPixmap, 0, picture, im_w, im_h,
                                   pad, 0)
        gc.PutImage(image, im_x, im_y, win_x, win_y, win_w, win_h)

Next: Drawing Text Prev: Drawing Up: Drawing Top: Top