gtk.Widget — the base class for all PyGTK
widgets
Functionsdef gtk.widget_push_colormap(cmap)def gtk.widget_push_composite_child()def gtk.widget_pop_composite_child()def gtk.widget_pop_colormap()def gtk.widget_get_default_style()def gtk.widget_set_default_colormap(colormap)def gtk.widget_get_default_colormap()def gtk.widget_get_default_visual()def gtk.widget_set_default_direction(dir)def gtk.widget_get_default_direction()def gtk.widget_class_find_style_property(widget,property_name)def gtk.widget_class_list_style_properties(widget)def gtk.widget_class_install_style_property(widget,pspec)
|
|
|
gobject.GObject Signal Prototypes
| "accel-closures-changed" | def callback( |
| "button-press-event" | def callback( |
| "button-release-event" | def callback( |
| "can-activate-accel" | def callback( |
| "child-notify" | def callback( |
| "composited-changed | def callback( |
| "client-event" | def callback( |
| "configure-event" | def callback( |
| "delete-event" | def callback( |
| "destroy-event" | def callback( |
| "direction-changed" | def callback( |
| "drag-begin" | def callback( |
| "drag-data-delete" | def callback( |
| "drag-data-get" | def callback( |
| "drag-data-received" | def callback( |
| "drag-drop" | def callback( |
| "drag-end" | def callback( |
| "drag-leave" | def callback( |
| "drag-motion" | def callback( |
| "enter-notify-event" | def callback( |
| "event" | def callback( |
| "event-after" | def callback( |
| "expose-event" | def callback( |
| "focus" | def callback( |
| "focus-in-event" | def callback( |
| "focus-out-event" | def callback( |
| "grab-broken-event | def callback( |
| "grab-focus" | def callback( |
| "grab-notify" | def callback( |
| "hide" | def callback( |
| "hierarchy-changed" | def callback( |
| "key-press-event" | def callback( |
| "key-release-event" | def callback( |
| "leave-notify-event" | def callback( |
| "map" | def callback( |
| "map-event" | def callback( |
| "mnemonic-activate" | def callback( |
| "motion-notify-event" | def callback( |
| "no-expose-event" | def callback( |
| "parent-set" | def callback( |
| "popup-menu" | def callback( |
| "property-notify-event" | def callback( |
| "proximity-in-event" | def callback( |
| "proximity-out-event" | def callback( |
| "realize" | def callback( |
| "screen-changed" | def callback( |
| "scroll-event" | def callback( |
| "selection-clear-event" | def callback( |
| "selection-get" | def callback( |
| "selection-notify-event" | def callback( |
| "selection-received" | def callback( |
| "selection-request-event" | def callback( |
| "show" | def callback( |
| "show-help" | def callback( |
| "size-allocate" | def callback( |
| "size-request" | def callback( |
| "state-changed" | def callback( |
| "style-set" | def callback( |
| "unmap" | def callback( |
| "unmap-event" | def callback( |
| "unrealize" | def callback( |
| "visibility-notify-event" | def callback( |
| "window-state-event" | def callback( |
The gtk.Widget class is
the base class for all PyGTK widgets. It provides the common set of method and signals for the widgets including:
gtk.Widget
introduces style properties - these are basically object properties that are
stored not on the object, but in the style object associated to the
widget. Style properties are set in resource files. This mechanism is used
for configuring such things as the location of the scrollbar arrows through
the theme, giving theme authors more control over the look of applications
without the need to write a theme engine in C.
Use the gtk.widget_class_install_style_property()
function to install style properties for a widget class, the gtk.widget_class_find_style_property()
function or the gtk.widget_class_list_style_properties()
function to get information about existing style properties and the
style_get_property()
method to obtain the value of a style property.
def get_allocation()| Returns : | a gtk.gdk.Rectangle |
The get_allocation() method returns a
gtk.gdk.Rectangle containing the bounds of the widget's allocation.
def drag_check_threshold(start_x, start_y, current_x, current_y)start_x : | the X coordinate of start of drag |
start_y : | the Y coordinate of start of drag |
current_x : | the current X coordinate |
current_y : | the current Y coordinate |
| Returns : | True if the drag threshold
has been passed. |
The check_drag_threshold() method checks to see if a mouse drag
starting at (start_x, start_y)
and ending at (current_x,
current_y) has passed the+ drag threshhold distance,
and thus should trigger the beginning of a drag-and-drop operation.
def drag_get_data(context, target, time=0L)context : | a gtk.gdk.DragContext |
target : | an atom |
time : | a timestamp or 0L to specify the current time |
The drag_get_data() method gets the
data associated with a drag specified by drag_context
and target. When the data is received or the
retrieval fails, a "drag_data_received" signal will be emitted. Failure of
the retrieval is indicated by the length field of the gtk.SelectionData
being negative. However, when the drag_get_data()
method is called implicitly because gtk.DRAG_DEFAULT_DROP
was set, the widget will not receive notification of failed drops.
def drag_highlight()The drag_highlight() method draws a
highlight around a widget. This will attach handlers to "expose_event" and
"draw", so the highlight will continue to be displayed until the drag_unhighlight()
method is called.
def drag_unhighlight()The drag_unhighlight() method removes
the highlight that was set by the drag_highlight()
method.
def drag_dest_set(flags, targets, actions)flags : | the flags that specify what actions should be
taken on behalf of a widget for drops onto that widget. The targets and
actions fields only are used if gtk.DEST_DEFAULT_MOTION
or gtk.DEST_DEFAULT_DROP are given. |
targets : | a sequence of target tuples |
actions : | a bitmask of possible actions for a drop onto this widget. |
The drag_dest_set() method sets up a
widget as a potential drag drop destination. The value of
flags is a combination of the GTK Dest Defaults Constants.
targets is a sequence (list or tuple) of
3-tuples that contain information about the targets. The target data contains
a string representing the drag type, target flags (a combination of
gtk.TARGET_SAME_APP and
gtk.TARGET_SAME_WIDGET or neither) and an application
assigned integer ID used for identification purposes.
The value of actions is one of the GDK Drag Action Constants.
def drag_dest_set_proxy(proxy_window, protocol, use_coordinates)proxy_window : | the gtk.gdk.Window to
forward drag events to |
protocol : | the drag protocol that
proxy_window accepts |
use_coordinates : | if True, send the same
coordinates to the destination, because it is an embedded
subwindow. |
The drag_dest_set_proxy() method sets a
proxy gtk.gdk.Window
specified by proxy_window that drag events are
forwarded to on behalf of the widget. The value of
protocol is one of the GDK Drag Protocol Constants.
If use_coordinates is
True, the same coordinates are sent to the destination
because the widget's an embedded subwindow.
def drag_dest_unset()The drag_dest_unset() method clears the
information about a drop destination set with the drag_dest_set()
method. The widget will no longer receive notification of drags.
def drag_dest_find_target(context, target_list)context : | the drag context |
target_list : | a list of droppable targets, or
None. |
| Returns : | the first target that the source offers and the
dest can accept, or None |
The dest_find_target() method looks for
a match between the targets in the gtk.gdk.DragContext
specified by context and the
target_list, returning the first matching target, or
NONE if no match is found. The list specified by
target_list should usually be the return value from
the drag_dest_get_target_list()
method, but some widgets may have different valid targets for different
parts of the widget; in that case, they will have to implement a
"drag-motion" handler that passes the correct target list to this method.
target_list is a sequence (list or tuple) of 3-tuples
that contain information about the targets. The target data contains a
string representing the drag type, target flags (a combination of
gtk.TARGET_SAME_APP and
gtk.TARGET_SAME_WIDGET or neither) and an application
assigned integer ID used for identification purposes.
def drag_dest_get_target_list()| Returns : | the list of targets or None
if no targets are set |
The drag_dest_get_target_list() method
returns the list of targets this widget can accept from drag-and-drop. The
returned value is a sequence (list or tuple) of 3-tuples that contain
information about the targets. The target data contains a string
representing the drag type, target flags (a combination of
gtk.TARGET_SAME_APP and
gtk.TARGET_SAME_WIDGET or neither) and an application
assigned integer ID used for identification purposes.
def drag_dest_set_target_list(target_list)target_list : | a list of droppable targets, or
None |
The drag_dest_set_target_list() method
sets the target types (that this widget can accept from drag-and-drop) to
the list specified by target_list. The widget must
first be made into a drag destination with the drag_dest_set()
method. target_list is a sequence (list or tuple) of
3-tuples that contain information about the targets. The target data contains
a string representing the drag type, target flags (a combination of
gtk.TARGET_SAME_APP and
gtk.TARGET_SAME_WIDGET or neither) and an application
assigned integer ID used for identification purposes.
def drag_dest_add_image_targets()This method is available in PyGTK 2.6 and above.
The drag_dest_add_image_targets()
method adds the image targets supported by gtk.SelectionData
to the target list of the widget's drag destination using an info value of
0.
def drag_dest_add_text_targets()This method is available in PyGTK 2.6 and above.
The drag_dest_add_text_targets() method
adds the text targets supported by gtk.SelectionData
to the target list of the widget's drag destination using an info value of
0.
def drag_dest_add_uri_targets()This method is available in PyGTK 2.6 and above.
The drag_dest_add_uri_targets() method adds the URI targets supported by gtk.SelectionData
to the target list of the widget's drag destination using an info value of
0.