GTK+ has its own way of dealing with application defaults, by using rc files. These can be used to set the colors of just about any widget, and can also be used to tile pixmaps onto the background of some widgets.
When your application starts, you should include a call to:
Passing in the
filename of your rc file. This
will cause GTK+ to parse this file, and use the style settings for the widget
types defined there.
If you wish to have a special set of widgets that can take on a different style from others, or any other logical division of widgets, use a call to:
Your newly created
widget will be assigned
name you give. This will allow you to change the
attributes of this
widget by name through the rc
If we use a call something like this:
button = gtk.Button("Special Button") button.set_name("special button")
button is given the name "special
button" and may be addressed by name in the rc file as "special
button.GtkButton". [--- Verify ME!]
Section 23.3, “Example rc file” below, sets the properties of the main window, and lets all children of that main window inherit the style described by the "main button" style. The code used in the application is:
window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_name("main window")
And then the style is defined in the rc file using:
widget "main window.*GtkButton*" style "main_button"
Which sets all the
Button (see Chapter 6, The Button Widget widgets in the "main window" to the
"main_buttons" style as defined in the rc file.
As you can see, this is a fairly powerful and flexible system. Use your imagination as to how best to take advantage of this.