gtk.Style — an object that hold style information for widgets
class gtk.Style(gobject.GObject): |
Even though the following attributes that are arrays of gtk.gdk.Color,
gtk.gdk.GC
or gtk.gdk.Pixmap
objects are read-only, the individual array items are
read-write.
|
gobject.GObject Signal Prototypes
| "realize | def callback( |
| "unrealize | def callback( |
A gtk.Style object
encapsulates the information that provides the look and feel for a widget.
Each gtk.Widget has an
associated gtk.Style object that
is used when rendering that widget. Usually the gtk.Style for a
widget is the same as the default style that is set by GTK and modified the
theme engine. A gtk.Style holds
information for the five possible widget states though not every widget
supports all five states:
gtk.STATE_NORMAL | The state of a sensitive widget that is not active and does not have the focus |
gtk.STATE_ACTIVE | The state of a sensitive widget when it is active e.g. a button that is pressed but not yet released |
gtk.STATE_PRELIGHT | The state of a sensitive widget that has the focus e.g. a button that has the mouse pointer over it. |
gtk.STATE_SELECTED | The state of a widget that is selected e.g. selected text
in a gtk.Entry
widget |
gtk.STATE_INSENSITIVE | The state of a widget that is insensitive and will not respond to any events e.g. cannot be activated, selected or prelit. |
A gtk.Style contains
the read-only attributes described in the above section.
Usually applications should not need to use or modify the gtk.Style of their
widgets.
def copy()| Returns : | a copy of the gtk.Style
object |
The copy() method returns a copy of the
style object.
def attach(window)window : | a gtk.Window. |
| Returns : | a gtk.Style
object |
The attach() method adapts a style to
the specified window. This process allocates the
colors and creates the graphics contexts for the style specializing them to
a particular visual and colormap. A new gtk.Style may be
created if the style has already been adapted to a window with a different
style and colormap.
def detach()The detach() method detaches the style and frees its resources if it is no longer attached.
def set_background(window, state_type)window : | a gtk.gdk.Window |
state_type : | a widget state |
The set_background() method sets the
background of window to the background color or
pixmap of the style for the widget state specified by
state_type.
def apply_default_background(window, set_bg, state_type, area, x, y, width, height)window : | a gtk.gdk.Window |
set_bg : | if True use the bg_pixmap
for the widget state |
state_type : | the widget state |
area : | the clipping area |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The apply_default_background() method
sets the background of the specified window in the
area specified by x, y,
width and height. The
background color is derived from the bg_gc of the style with the state
specified by state_type. If
area is not None it specifies a
clipping area for the application of the background.
def lookup_icon_set(stock_id)stock_id : | a stock ID |
| Returns : | a gtk.IconSet |
The lookup_icon_set() method looks in
the gtk.IconFactory
list associated with the style and the default icon factory for the stock
icon specified by stock_id. If the stock icon iconset
is found it is returned.
def render_icon(source, direction, state, size, widget=None, detail=None)source : | the gtk.IconSource
specifying the icon to render |
direction : | a text direction |
state : | a widget state |
size : | the size to render the icon at. A size of -1 means render at the size of the source and don't scale. |
widget : | a widget |
detail : | a style detail |
| Returns : | a gtk.gdk.Pixbuf |
The render_icon() method renders the
icon specified by source at the specified
size for the specified widget
state according to the given parameters and returns
the result in a gtk.gdk.Pixbuf.
def paint_hline(window, state_type, area, widget, detail, x1, x2, y)window : | a gtk.gdk.Window |
state_type : | a widget state |
area : | the rectangle that clips the output |
widget : | a widget |
detail : | a detail string |
x1 : | the starting x coordinate |
x2 : | the ending x coordinate |
y : | the y coordinate |
The paint_hline() method draws a
horizontal line from (x1, y)
to (x2, y) in
window using the specified
state_type of the style. If
area is not None the line is
clipped by the rectangle specified by area.
def paint_vline(window, state_type, area, widget, detail, y1, y2, x)window : | a gtk.gdk.Window |
state_type : | a widget state |
area : | the rectangle to which the output is clipped |
widget : | a widget |
detail : | a detail string |
y1 : | the starting y coordinate |
y2 : | the ending y coordinate |
x : | the x coordinate |
The paint_vline() method draws a
vertical line from (x, y1) to
(x, y2) in
window using the specified
state_type of the style. If
area is not None the line is
clipped by the rectangle specified by area.
def paint_shadow(window, state_type, shadow_type, area, widget, detail, x, y, width, height)window : | a gtk.gdk.Window* |
state_type : | a widget state |
shadow_type : | a type of shadow - one of:
gtk.SHADOW_NONE, gtk.SHADOW_IN,
gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN,
gtk.SHADOW_ETCHED_OUT |
area : | the rectangle to which the output is clipped |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_shadow() method draws a
shadow of the specified shadow_type on the specified
window with the size specified by
x, y,
width and height. If
area is not None the shadow is
clipped to the rectangle' area. state_type specifies
the style state to use for drawing.
def paint_polygon(window, state_type, shadow_type, area, widget, detail, points, fill)window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of:
gtk.SHADOW_NONE, gtk.SHADOW_IN,
gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN,
gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
points : | a list or tuple containing point (x, y) tuples |
fill : | if True the polygon should
be filled |
The paint_polygon() method draws a
polygon on the specified window with the shadow type
specified by shadow_type connecting the points
specified by points. If area
is not None it specifies a clipping rectangle. The style
state specified by state_type determines the graphics
context to use while drawing.
def paint_arrow(window, state_type, shadow_type, area, widget, detail, arrow_type, fill, x, y, width, height)window : | a gtk.gdk.Window |
state_type : | the widget state |
shadow_type : | a shadow type - one of:
gtk.SHADOW_NONE, gtk.SHADOW_IN,
gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN,
gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
arrow_type : | an arrow type - one of:
gtk.ARROW_UP, gtk.ARROW_DOWN,
gtk.ARROW_LEFT,
gtk.ARROW_RIGHT |
fill : | if True the arrow should be
filled |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_arrow() method draws an arrow
of the type specified by arrow_type on the specified
window with the shadow type specified by
shadow_type with the location and size specified by
x, y,
width and height. If
area is not None it specifies a
clipping rectangle. The widget state specified by
state_type determines the graphics context to use
while drawing.
def paint_diamond(window, state_type, shadow_type, area, widget, detail, x, y, width, height)window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of:
gtk.SHADOW_NONE, gtk.SHADOW_IN,
gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN,
gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_diamond() method draws a
diamond on the specified window with the shadow type
specified by shadow_type and the location and size
specified by x, y,
width and height. If
area is not None it specifies a
clipping rectangle. The widget state specified by
state_type determines the graphics context to use
while drawing.
def paint_box(window, state_type, shadow_type, area, widget, detail, x, y, width, height)window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of:
gtk.SHADOW_NONE, gtk.SHADOW_IN,
gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN,
gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_box() method draws a box on
the specified window with the shadow type specified
by shadow_type and the location and size specified by
x, y,
width and height. If
area is not None it specifies a
clipping rectangle. The widget state specified by
state_type determines the graphics context to use
while drawing.
def paint_flat_box(window, state_type, shadow_type, area, widget, detail, x, y, width, height)window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of:
gtk.SHADOW_NONE, gtk.SHADOW_IN,
gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN,
gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_flat_box() method draws a
flat box (no shadow) on the specified window with
the location and size specified by x,
y, width and
height. If area is not
None it specifies a clipping rectangle. The style state
specified by state_type determines the graphics
context to use while drawing.
def paint_check(window, state_type, shadow_type, area, widget, detail, x, y, width, height)window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of:
gtk.SHADOW_NONE, gtk.SHADOW_IN,
gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN,
gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_check() method draws a check
on the specified window with the shadow type
specified by shadow_type and the location and size
specified by x, y,
width and height. If
area is not None it specifies a
clipping rectangle. The widget state specified by
state_type determines the graphics context to use
while drawing.
def paint_option(window, state_type, shadow_type, area, widget, detail, x, y, width, height)window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of:
gtk.SHADOW_NONE, gtk.SHADOW_IN,
gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN,
gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_option() method draws an
option menu item on the specified window with the
shadow type specified by shadow_type and the location
and size specified by x, y,
width and height. If
area is not None it specifies a
clipping rectangle. The widget state specified by
state_type determines the graphics context to use
while drawing.
def paint_tab(window, state_type, shadow_type, area, widget, detail, x, y, width, height)window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of:
gtk.SHADOW_NONE, gtk.SHADOW_IN,
gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN,
gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_tab() method draws a tab on
the specified window with the shadow type specified
by shadow_type and the location and size specified by
x, y,
width and height. If
area is not None it specifies a
clipping rectangle. The widget state specified by
state_type determines the graphics context to use
while drawing.
def paint_shadow_gap(window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width)window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of:
gtk.SHADOW_NONE, gtk.SHADOW_IN,
gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN,
gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
gap_side : | a position - one of:
gtk.POS_LEFT, gtk.POS_RIGHT,
gtk.POS_TOP,
gtk.POS_BOTTOM |
gap_x : | the x position of the gap |
gap_width : | the gap width |
The paint_shadow_gap() method draws a
shadow with a gap on the specified window with the
shadow type specified by shadow_type and the location
and size specified by x, y,
width and height. The gap
position and width is specified by gap_side,
gap_x and gap_width. If
area is not None it specifies a
clipping rectangle. The widget state specified by
state_type determines the graphics context to use
while drawing.
def paint_box_gap(window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width)window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of:
gtk.SHADOW_NONE, gtk.SHADOW_IN,
gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN,
gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
gap_side : | a position - one of:
gtk.POS_LEFT, gtk.POS_RIGHT,
gtk.POS_TOP,
gtk.POS_BOTTOM |
gap_x : | the x position of the gap |
gap_width : | the gap width |
The paint_box_gap() method draws a box
with a gap on the specified window with the shadow
type specified by shadow_type and the location and
size specified by x, y,
width and height. The gap
position and width is specified by gap_side,
gap_x and gap_width. If
area is not None it specifies a
clipping rectangle. The widget state specified by
state_type determines the graphics context to use
while drawing.
def paint_extension(window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side)window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of:
gtk.SHADOW_NONE, gtk.SHADOW_IN,
gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN,
gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
gap_side : | a position - one of:
gtk.POS_LEFT, gtk.POS_RIGHT,
gtk.POS_TOP,
gtk.POS_BOTTOM |
The paint_extension() method draws an
extension on the specified window with the shadow
type specified by shadow_type and the location and
size specified by x, y,
width and height. The
extension position is specified by gap_side. If
area is not None it specifies a
clipping rectangle. The widget state specified by
state_type determines the graphics context to use
while drawing.
def paint_focus(window, state_type, area, widget, detail, x, y, width, height)window : | a gtk.gdk.Window |
state_type : | a widget state |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_focus() method draws a focus
indicator on the specified window with the location
and size specified by x, y,
width and height. If
area is not None it specifies a
clipping rectangle. The widget state specified by
state_type determines the graphics context to use
while drawing.
def paint_slider(window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation)window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of:
gtk.SHADOW_NONE, gtk.SHADOW_IN,
gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN,
gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
orientation : | a position - one of:
gtk.ORIENTATION_HORIZONTAL or
gtk.ORIENTATION_VERTICAL |
The paint_slider() method draws a
slider with the specified orientation on the
specified window with the shadow type specified by
shadow_type and the location and size specified by
x, y,
width and height. If
area is not None it specifies a
clipping rectangle. The widget state specified by
state_type determines the graphics context to use
while drawing.
def paint_handle(window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation)window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of:
gtk.SHADOW_NONE, gtk.SHADOW_IN,
gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN,
gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
orientation : | a position - one of:
gtk.ORIENTATION_HORIZONTAL or
gtk.ORIENTATION_VERTICAL |
The paint_handle() method draws a
handle with the specified orientation on the
specified window with the shadow type specified by
shadow_type and the location and size specified by
x, y,
width and height. If
area is not None it specifies a
clipping rectangle. The widget state specified by
state_type determines the graphics context to use
while drawing.
def paint_expander(window, state_type, area, widget, detail, x, y, expander_style)window : | a gtk.gdk.Window |
state_type : | a widget state |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
expander_style : | an expander style - one of:
gtk.EXPANDER_COLLAPSED,
gtk.EXPANDER_SEMI_COLLAPSED,
gtk.EXPANDER_SEMI_EXPANDED or
gtk.EXPANDER_EXPANDED |
The paint_expander() method draws an
expander with the specified expander_style on the
specified window at the location specified by
x, y. If
area is not None it specifies a
clipping rectangle. The widget state specified by
state_type determines the graphics context to use
while drawing.
def paint_layout(window, state_type, use_text, area, widget, detail, x, y, layout)window : | a gtk.gdk.Window |
state_type : | a widget state |
use_text : | if True use the text
graphics context for drawing |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
layout : | a Pango.Layout object
containing the text to display |
The paint_layout() method draws the
text in a pango.Layout specified by
layout on the specified window
at the location specified by x and
y. If text is True use the text
graphics context of the style for drawing, otherwise use the fg graphics
context. If area is not None it
specifies a clipping rectangle. The widget state specified by
state_type determines the graphics context to use
while drawing.
def paint_resize_grip(window, state_type, area, widget, detail, edge, x, y, width, height)window : | a gtk.gdk.Window |