goocanvas.Item

goocanvas.Item — The interface for canvas items.

Synopsis

class goocanvas.Item(gobject.GInterface):
    def add_child(item, position)
def animate(x, y, scale, degrees, duration, step_time, type)
def find_child(child)
def get_child(child_num)
def get_model()
def get_n_children()
def get_parent()
def get_transform()
def is_container()
def lower(below)
def move_child(old_position, new_position)
def raise_(above)
def remove_child(child_num)
def rotate(degrees, cx, cy)
def scale(sx, sy)
def set_parent(parent)
def set_transform(matrix)
def skew_x(degrees, cx, cy)
def skew_y(degrees, cx, cy)
def stop_animation()
def translate(tx, ty)

Ancestry

+-- gobject.GInterface
    +-- goocanvas.Item

goocanvas.Item Properties

"description"Read / WriteA description of the item for use by assistive technologies. Default value: NULL
"pointer-events"Read / WriteSpecifies when the item receives pointer events. Default value: goocanvas.EVENTS_VISIBLE_MASK|goocanvas.EVENTS_PAINTED_MASK| goocanvas.EVENTS_FILL_MASK|goocanvas.EVENTS_STROKE_MASK
"title"Read / WriteA short context-rich description of the item for use by assistive technologies. Default value: NULL
"transform"Read / WriteThe transformation matrix of the item.
"visibility"Read / WriteWhen the canvas item is visible. Default value: GOO_CANVAS_ITEM_VISIBLE.
"visibility-threshold"Read / WriteThe scale threshold at which the item becomes visible. Allowed values: >= 0 Default value: 0

goocanvas.Item Signal Prototypes

"changed" def callback(item, recompute_bounds, user_param, ...)
"child-added" def callback(item, child_num, user_param, ...)
"child-moved" def callback(item, old_child_num, new_child_num, user_param, ...)
"child-removed" def callback(item, child_num, user_param, ...)

Known Implementation

goocanvas.Item is implementated by goocanvas.Rect goocanvas.Ellipse goocanvas.Path goocanvas.Polyline goocanvas.Text goocanvas.Image goocanvas.Group goocanvas.ItemSimple

Description

goocanvas.Item defines the interface that canvas items must implement, and contains methods for operating on canvas items.

Methods

goocanvas.Item.add_child

    def add_child(item, position)
item :The item to add.
position :the position of the item, or -1 to place it last (at the top of the stacking order).

Adds a child item to a container item at the given stack position.

goocanvas.Item.animate

    def animate(x, y, scale, degrees, duration, step_time, type)
x :the final x offset from the current position.
y :the final y offset from the current position.
scale :the final scale of the item.
degrees :the final rotation of the item.
duration :the duration of the animation, in milliseconds (1/1000ths of a second).
step_time :the time between each animation step, in milliseconds.
type :specifies what happens when the animation finishes.

Animates an item from its current position to the given offsets, scale and rotation.

goocanvas.Item.find_child

    def find_child(child)
child :the child item to find.
Returns :The position of the given child item, or -1 if it isn't found.

Attempts to find the given child item with the container's stack.

goocanvas.Item.get_child

    def get_child(child_num)
child_num :the position of a child in the container's stack.
Returns :The child item at the given stack position.

Gets the child item at the given stack position.

goocanvas.Item.get_model

    def get_model()
Returns :the canvas model, or NULL of the item isn't in a model.

Gets the canvas model containing the given item.

goocanvas.Item.get_n_children

    def get_n_children()
Returns :The number of children.

Gets the number of children of the container.

goocanvas.Item.get_parent

    def get_parent()
Returns :The parent item, or NULL if the item has no parent.

Gets the parent of the given item.

goocanvas.Item.get_transform

    def get_transform()
Returns :The item's transformation matrix.

Gets the transformation matrix of an item.

goocanvas.Item.is_container

    def is_container()
Returns :TRUE if the item is a container.

Tests to see if the given item is a container.

goocanvas.Item.lower

    def lower(below)
below :the item to lower item below, or NULL to lower item to the bottom of the stack.

Lowers an item in the stacking order.

goocanvas.Item.move_child

    def move_child(old_position, new_position)
old_position :the current position of the child item.
new_position :the new position of the child item.

Moves a child item to a new stack position within the container.

goocanvas.Item.raise_

    def raise_(above)
above :the item to raise item above, or NULL to raise item to the top of the stack.

Raises an item in the stacking order.

goocanvas.Item.remove_child

    def remove_child(child_num)
child_num :the position of the child item to remove.

Removes the child item at the given position.

goocanvas.Item.rotate

    def rotate(degrees, cx, cy)
degrees :the clockwise angle of rotation.
cx :the x coordinate of the origin of the rotation.
cy :the y coordinate of the origin of the rotation.

Rotates the item's coordinate system by the given amount, about the given origin.

goocanvas.Item.scale

    def scale(sx, sy)
sx :the amount to scale the horizontal axis.
sy :the amount to scale the vertical axis.

Scales the item's coordinate system by the given amounts.

goocanvas.Item.set_parent

    def set_parent(parent)
parent :the new parent item.

Sets the parent of the item.

goocanvas.Item.set_transform

    def set_transform(matrix)
matrix :the new transformation matrix, or NULL to reset the transformation to the identity matrix.

Sets the transformation matrix of an item.

goocanvas.Item.skew_x

    def skew_x(degrees, cx, cy)
degrees :the skew angle.
cx :the x coordinate of the origin of the skew transform.
cy :the y coordinate of the origin of the skew transform.

Skews the item's coordinate system along the x axis by the given amount, about the given origin.

goocanvas.Item.skew_y

    def skew_y(degrees, cx, cy)
degrees :the skew angle.
cx :the x coordinate of the origin of the skew transform.
cy :the y coordinate of the origin of the skew transform.

Skews the item's coordinate system along the y axis by the given amount, about the given origin.

goocanvas.Item.stop_animation

    def stop_animation()

Stops any current animation for the given item, leaving it at its current position.

goocanvas.Item.translate

    def translate(tx, ty)
tx :the amount to move the origin in the horizontal direction.
ty :the amount to move the origin in the vertical direction.

Translates the origin of the item's coordinate system by the given amounts.

Signals

The "changed" goocanvas.Item Signal

    def callback(item, recompute_bounds, user_param, ...)
item : The goocanvas.Item that received the signal.
recompute_bounds : If the bounds of the item need to be recomputed.
user_param :the first user parameter (if any) specified with the connect() method
... :additional user parameters (if any)

The 'changed" signal is emitted when the item has been changed.

The "child-added" goocanvas.Item Signal

    def callback(item, child_num, user_param, ...)
item : The goocanvas.Item that received the signal.
child_num : The index of the new child.
user_param :the first user parameter (if any) specified with the connect() method
... :additional user parameters (if any)

The "child-added" signal is emitted when a child has been added to the container item.

The "child-moved" goocanvas.Item Signal

    def callback(item, old_child_num, new_child_num, user_param, ...)
item : The goocanvas.Item that received the signal.
old_child_num : The old index of the child.
new_child_num : The new index of the child.
user_param :the first user parameter (if any) specified with the connect() method
... :additional user parameters (if any)

The "child-moved" signal is emitted when a child has been moved in the stacking order of a container item.

The "child-removed" goocanvas.Item Signal

    def callback(item, child_num, user_param, ...)
item : The goocanvas.Item that received the signal.
child_num : The index of the child that was removed.
user_param :the first user parameter (if any) specified with the connect() method
... :additional user parameters (if any)

The "child-removed" signal is emitted when a child has been removed from the container item.