/usr/share/doc/python-gtk2-tutorial/html/sec-WidgetStyles.html is in python-gtk2-tutorial 2.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>18.5. Widget Styles</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Tutorial"><link rel="up" href="ch-SettingWidgetAttributes.html" title="Chapter 18. Setting Widget Attributes"><link rel="previous" href="sec-WidgetNameMethods.html" title="18.4. Widget Name Methods"><link rel="next" href="ch-TimeoutsIOAndIdleFunctions.html" title="Chapter 19. Timeouts, IO and Idle Functions"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">18.5. Widget Styles</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sec-WidgetNameMethods.html">Prev</a> </td><th width="60%" align="center">Chapter 18. Setting Widget Attributes</th><td width="20%" align="right"> <a accesskey="n" href="ch-TimeoutsIOAndIdleFunctions.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec-WidgetStyles"></a>18.5. Widget Styles</h2></div></div><div></div></div><p>The following methods get and set the style associated with a
widget:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
widget.set_style(<b class="parameter"><tt>style</tt></b>)
style = widget.get_style()
</pre></td></tr></table><p>The following function:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
style = get_default_style()
</pre></td></tr></table><p>gets the default style.</p><p>A style contains the graphics information needed by a widget to
draw itself in its various states:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
STATE_NORMAL # The state during normal operation.
STATE_ACTIVE # The widget is currently active, such as a button pushed
STATE_PRELIGHT # The mouse pointer is over the widget.
STATE_SELECTED # The widget is selected
STATE_INSENSITIVE # The widget is disabled
</pre></td></tr></table><p>A style contains the following attributes:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
fg # a list of 5 foreground colors - one for each state
bg # a list of 5 background colors
light # a list of 5 colors - created during set_style() method
dark # a list of 5 colors - created during set_style() method
mid # a list of 5 colors - created during set_style() method
text # a list of 5 colors
base # a list of 5 colors
text_aa # a list of 5 colors halfway between text/base
black # the black color
white # the white color
font_desc # the default pango font description
xthickness #
ythickness #
fg_gc # a list of 5 graphics contexts - created during set_style() method
bg_gc # a list of 5 graphics contexts - created during set_style() method
light_gc # a list of 5 graphics contexts - created during set_style() method
dark_gc # a list of 5 graphics contexts - created during set_style() method
mid_gc # a list of 5 graphics contexts - created during set_style() method
text_gc # a list of 5 graphics contexts - created during set_style() method
base_gc # a list of 5 graphics contexts - created during set_style() method
black_gc # a list of 5 graphics contexts - created during set_style() method
white_gc # a list of 5 graphics contexts - created during set_style() method
bg_pixmap # a list of 5 GdkPixmaps
</pre></td></tr></table><p>Each attribute can be accessed directly similar to
<i class="parameter"><tt>style.black</tt></i> and
<i class="parameter"><tt>style.fg_gc[gtk.STATE_NORMAL]</tt></i>. All attributes are
read-only except for <i class="parameter"><tt>style.black</tt></i>,
<i class="parameter"><tt>style.white</tt></i>, <i class="parameter"><tt>style.black_gc</tt></i> and
<i class="parameter"><tt>style.white_gc</tt></i>.</p><p>An existing style can be copied for later modification by using
the method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
new_style = style.copy()
</pre></td></tr></table><p>which copies the <i class="parameter"><tt>style</tt></i> attributes except
for the graphics context lists and the light, dark and mid color
lists.</p><p>The current style of a widget can be retrieved with:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
style = widget.get_style()
</pre></td></tr></table><p>To change the style of a widget (e.g. to change the widget
foreground color), the following widget methods should be used:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
widget.modify_fg(state, color)
widget.modify_bg(state, color)
widget.modify_text(state, color)
widget.modify_base(state, color)
widget.modify_font(font_desc)
widget.set_style(style)
</pre></td></tr></table><p>Setting the <i class="parameter"><tt>style</tt></i> will allocate the style
colors and create the graphics contexts. Most widgets will automatically
redraw themselves after the style is changed. If
<i class="parameter"><tt>style</tt></i> is <tt class="literal">None</tt> then the widget
style will revert to the default style.</p><p>Not all style changes will affect the widget. For example,
changing the <tt class="classname">Label</tt> (see <a href="ch-MiscellaneousWidgets.html#sec-Labels" title="9.1. Labels">Section 9.1, “Labels”</a>) widget background color will not change the
label background color because the <tt class="classname">Label</tt> widget does
not have its own <tt class="classname">gtk.gdk.Window</tt>. The background of
the label is dependent on the background color of the label's parent. The
use of an <tt class="classname">EventBox</tt> to hold a Label will allow the
Label background color to be set. See <a href="ch-ContainerWidgets.html#sec-EventBox" title="10.1. The EventBox">Section 10.1, “The EventBox”</a> for an
example.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sec-WidgetNameMethods.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch-SettingWidgetAttributes.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch-TimeoutsIOAndIdleFunctions.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">18.4. Widget Name Methods </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 19. Timeouts, IO and Idle Functions</td></tr></table></div></body></html>
|