FAQ Index - Search - Recent Changes - Everything - Add entry

<< Previous Entry | FAQ Entry 4.5 | Next Entry >>

4.5. How do I use the style object?

Each widget has an associates style object that can be manipulted. The basic method is get_style(), which returns a GtkStyle object, and the associated set_style(style_object).

The style is shared between widgets of the same type (XXX: is this true?). To change the style of only one widget in your application, the style object offers a copy() method, which returns a new copy of the GdkStyle, which can me changed and set_style() back to the desired widget.

All attributes of a style can be get and set independently by direct access. The most important attributes of style are the colours (see faq 4.6):

And the font and bg_pixmap attributes.

PyGTK FAQ Wizard | PyGTK Homepage | Feedback to faq at pygtk.org