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(). One way to get a Visual Info object is by using the widget method DefaultVisualOfScreen() which returns a Visual Info object.

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)