Chapter 18. Setting Widget Attributes

Table of Contents

18.1. Widget Flag Methods
18.2. Widget Display Methods
18.3. Widget Accelerators
18.4. Widget Name Methods
18.5. Widget Styles

This describes the methods used to operate on widgets (and objects). These can be used to set style, padding, size, etc.

The method:

  widget.activate()

causes the widget to emit the "activate" signal.

The method:

  widget.set_sensitive(sensitive)

sets the sensitivity of the widget (i.e. does it react to events). if sensitive is TRUE the widget will receive events; if FALSE the widget will not receive events. A widget that is insensitive is usually displayed "grayed out".

The method:

  widget.set_size_request(width, height)

sets the widget size to the given width and height.

18.1. Widget Flag Methods

The methods:

  widget.set_flags(flags)

  widget.unset_flags(flags)

  flags = widget.flags()

set, unset and get the gtk.Object and gtk.Widget flags. flags can be any of the standard flags:

  IN_DESTRUCTION
  FLOATING
  RESERVED_1
  RESERVED_2
  TOPLEVEL
  NO_WINDOW
  REALIZED
  MAPPED
  VISIBLE
  SENSITIVE
  PARENT_SENSITIVE
  CAN_FOCUS
  HAS_FOCUS
  CAN_DEFAULT
  HAS_DEFAULT
  HAS_GRAB
  RC_STYLE
  COMPOSITE_CHILD
  NO_REPARENT
  APP_PAINTABLE
  RECEIVES_DEFAULT
  DOUBLE_BUFFERED

The method:

  widget.grab_focus()

allows a widget to grab the focus assuming that it has the CAN_FOCUS flag set.