Drawing Text -- X Python Reference Manual

Prev: Drawing Images Up: Drawing Top: Top

## 1.2.2. Drawing Text

To draw text, a font must first be selected. A font object is acquired by using the widget method `LoadQueryFont`. This object can then be passed to the GC method `SetFont` or assigned to the GC instance variable `font`.

For example:

        font = w.LoadQueryFont(
                        '-*-times-medium-r-*-*-*-100-*-*-*-*-iso8859-1')
        gc.SetFont(font)
        gc.DrawString(x, y, 'Hello World!')

Prev: Drawing Images Up: Drawing Top: Top