Next: Non-default visuals Prev: Naming and coding conventions Up: Introduction Top: Top
An off-screen Pixmap can be created using the widget method
CreatePixmap
.
In order to draw in a widget or on a Pixmap, a Graphics Context object
instance must be created. This can be done using the widget methods
CreateGC
and GetGC
, or the Pixmap method
CreateGC
.
Once a Graphics Context object is instantiated, the Xlib drawing functions can be used. These drawing functions are methods of the Graphics Context object.
For example, in order to draw a rectangle in a window, the following code could be used.
values = {'line_style': X.LineOnOffDash}
gc = w.GetGC(values)
gc.DrawRectangle(x, y, width, height)