Package evas :: Module c_evas :: Class Object
[hide private]
[frames] | no frames]

Class Object

object --+
         |
        Object
Known Subclasses:

Basic Graphical Object (or actor).

Objects are managed by Canvas in a non-immediate way, that is, all operations, like moving, resizing, changing the color, etc will not trigger immediate repainting, instead it will save the new state and mark both this object and its Canvas as "dirty" so can be redrawn on Canvas.render() (usually called by the underlying system, like ecore.evas when you're entering idle. This means that doesn't matter how many times you're moving an object between frame updates: just the last state will be used, that's why you really should do animations using ecore.animator_add() instead of ecore.timer_add(), since it will call registered functions in one batch and then trigger redraw, instead of calling one function, then redraw, then the next function, and redraw...

The most important concept for evas object is clipping (clip_set() and clip_unset()), ususally done by use of Rectangle as clipper. Clip objects will affect the drawing behavior:

Clips respects the hierarchy: the minimum area and the composed color will be used used at the end, if one object is not visible, othe lower objects (clipped by it) will not be visible as well. Clipping is the recommended way of doing fade out/in effect, instead of changing object's color, clip it to a rectangle and change its color: this will work as expected with every object, unlike directly changing color that just work for Images.

As with every evas component, colors should be specified in pre-multiplied format, see evas.color_parse() and evas.color_argb_premul().

Objects can be grouped by means of SmartObject, a virtual class that can have it's methods implemented in order to apply methods to its children.


Attention: since we have two systems controlling object's life (Evas and Python) objects need to be explicitly deleted using delete() call. If this call is not issued, the Python object will not be released, but if the object is deleted by Evas (ie: due parent deletion), the object will become "shallow" and all operations will either have no effect or raise exceptions. You can be notified of object deletion by the EVAS_CALLBACK_FREE (see on_free_add() or event_callback_add().

Instance Methods [hide private]
 
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
a new object with type S, a subtype of T
__new__(T, S, ...)
 
__repr__(x)
repr(x)
 
__str__(x)
str(x)
 
_set_common_params(...)
Set common parameters in one go.
 
_set_evas(...)
tuple of int
bottom_center_get(...)
 
bottom_center_set(...)
Set (x, y) of bottom-center.
tuple of Object
clipees_get(...)
Return objects currently clipped by this.
Canvas
evas_get(...)
tuple of int
left_center_get(...)
 
left_center_set(...)
Set (x, y) of left-center.
str
name_get(...)
 
name_set(...)
Set the name of one object.
 
on_changed_size_hints_add(...)
Same as event_callback_add(EVAS_CALLBACK_CHANGED_SIZE_HINTS, ...)
 
on_changed_size_hints_del(...)
Same as event_callback_del(EVAS_CALLBACK_CHANGED_SIZE_HINTS, ...)
 
on_del_add(...)
Same as event_callback_add(EVAS_CALLBACK_DEL, ...)
 
on_del_del(...)
Same as event_callback_del(EVAS_CALLBACK_DEL, ...)
Object
parent_get(...)
Get object's parent, in the case it was added to some SmartObject.
tuple of int
right_center_get(...)
 
right_center_set(...)
Set (x, y) of right-center.
tuple of floats (x, y)
size_hint_align_get(...)
Retrieve alignment hint.
 
size_hint_align_set(...)
Set hint for alignment.
tuple of integers (aspect, w, h)
size_hint_aspect_get(...)
Retrieve aspect hint.
 
size_hint_aspect_set(...)
Set hint for aspect.
tuple of integers (w, h)
size_hint_max_get(...)
Retrieve maximum size hint.
 
size_hint_max_set(...)
Set hint for maximum size.
tuple of integers (w, h)
size_hint_min_get(...)
Retrieve minimum size hint.
 
size_hint_min_set(...)
Set hint for minimum size.
tuple of integers (l, r, t, b)
size_hint_padding_get(...)
Retrieve padding hint.
 
size_hint_padding_set(...)
Set hint for padding.
tuple of integers (w, h)
size_hint_request_get(...)
Retrieve request size hint.
 
size_hint_request_set(...)
Set hint for request size.
tuple of floats (x, y)
size_hint_weight_get(...)
Retrieve weight hint.
 
size_hint_weight_set(...)
Set hint for weight.
tuple of int
top_center_get(...)
 
top_center_set(...)
Set (x, y) of top-center.
str
type_get(...)
Get the Evas object's type

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

    State manipulation
Object or None
clip_get(...)
Return the object currently clipping this object, or None.
 
clip_set(...)
Set the object to clip this object, or None to unset.
 
clip_unset(...)
Remove any clip of this object.
tuple of int
color_get(...)
Get object color (r, g, b, a) (uses pre-multiply colorspace!)
 
color_set(...)
Set object color using r, g, b, a (uses pre-multiply colorspace!)
 
delete(...)
Delete object and free it's internal (wrapped) resources.
 
hide(...)
bool
is_deleted(...)
 
show(...)
bool
visible_get(...)
 
visible_set(...)
    Positioning
tuple of int
bottom_left_get(...)
 
bottom_left_set(...)
Set (x, y) of bottom-left corner.
tuple of int
bottom_right_get(...)
 
bottom_right_set(...)
Set (x, y) of bottom-right corner.
tuple of int
center_get(...)
 
center_set(...)
Set (x, y) of center.
tuple of int
geometry_get(...)
 
geometry_set(...)
Set object geometry (position and size).
 
move(...)
Same as pos_set().
 
move_relative(...)
Move relatively to current position
tuple of int
pos_get(...)
 
pos_set(...)
Set object position.
 
resize(...)
Same as size_set().
tuple of int
size_get(...)
 
size_set(...)
Set object size.
tuple of int
top_left_get(...)
 
top_left_set(...)
Set (x, y) of top-left corner.
tuple of int
top_right_get(...)
 
top_right_set(...)
Set (x, y) of top-right corner.
    Layer & Stack manipulation
Object
above_get(...)
Return the object above this.
Object
below_get(...)
Return the object below this.
Object
bottom_get(...)
Return the bottommost object.
int
layer_get(...)
 
layer_set(...)
 
lower(...)
Lower to the bottom of its layer.
 
raise_(...)
Raise to the top of its layer.
 
stack_above(...)
Reorder to be above the given one.
 
stack_below(...)
Reorder to be below the given one.
Object
top_get(...)
Return the topmost object.
    Event processing control
bool
focus_get(...)
Returns if this object currently have the focus.
 
focus_set(...)
Give focus to object.
bool
pass_events_get(...)
 
pass_events_set(...)
Enable or disable event processing by this object.
bool
propagate_events_get(...)
 
propagate_events_set(...)
Enable or disable propagation of events to parent.
bool
repeat_events_get(...)
 
repeat_events_set(...)
Enable or disable events to continue propagation after processed.
    Event callbacks
 
event_callback_add(...)
Add a new callback for the given event.
 
event_callback_del(...)
Remove callback for the given event.
 
on_focus_in_add(...)
Same as event_callback_add(EVAS_CALLBACK_FOCUS_IN, ...)
 
on_focus_in_del(...)
Same as event_callback_del(EVAS_CALLBACK_FOCUS_IN, ...)
 
on_focus_out_add(...)
Same as event_callback_add(EVAS_CALLBACK_FOCUS_OUT, ...)
 
on_focus_out_del(...)
Same as event_callback_del(EVAS_CALLBACK_FOCUS_OUT, ...)
 
on_free_add(...)
Same as event_callback_add(EVAS_CALLBACK_FREE, ...)
 
on_free_del(...)
Same as event_callback_del(EVAS_CALLBACK_FREE, ...)
 
on_hide_add(...)
Same as event_callback_add(EVAS_CALLBACK_HIDE, ...)
 
on_hide_del(...)
Same as event_callback_del(EVAS_CALLBACK_HIDE, ...)
 
on_hold_add(...)
Same as event_callback_add(EVAS_CALLBACK_HOLD, ...)
 
on_hold_del(...)
Same as event_callback_del(EVAS_CALLBACK_HOLD, ...)
 
on_key_down_add(...)
Same as event_callback_add(EVAS_CALLBACK_KEY_DOWN, ...)
 
on_key_down_del(...)
Same as event_callback_del(EVAS_CALLBACK_KEY_DOWN, ...)
 
on_key_up_add(...)
Same as event_callback_add(EVAS_CALLBACK_KEY_UP, ...)
 
on_key_up_del(...)
Same as event_callback_del(EVAS_CALLBACK_KEY_UP, ...)
 
on_mouse_down_add(...)
Same as event_callback_add(EVAS_CALLBACK_MOUSE_DOWN, ...)
 
on_mouse_down_del(...)
Same as event_callback_del(EVAS_CALLBACK_MOUSE_DOWN, ...)
 
on_mouse_in_add(...)
Same as event_callback_add(EVAS_CALLBACK_MOUSE_IN, ...)
 
on_mouse_in_del(...)
Same as event_callback_del(EVAS_CALLBACK_MOUSE_IN, ...)
 
on_mouse_move_add(...)
Same as event_callback_add(EVAS_CALLBACK_MOUSE_MOVE, ...)
 
on_mouse_move_del(...)
Same as event_callback_del(EVAS_CALLBACK_MOUSE_MOVE, ...)
 
on_mouse_out_add(...)
Same as event_callback_add(EVAS_CALLBACK_MOUSE_OUT, ...)
 
on_mouse_out_del(...)
Same as event_callback_del(EVAS_CALLBACK_MOUSE_OUT, ...)
 
on_mouse_up_add(...)
Same as event_callback_add(EVAS_CALLBACK_MOUSE_UP, ...)
 
on_mouse_up_del(...)
Same as event_callback_del(EVAS_CALLBACK_MOUSE_UP, ...)
 
on_mouse_wheel_add(...)
Same as event_callback_add(EVAS_CALLBACK_MOUSE_WHEEL, ...)
 
on_mouse_wheel_del(...)
Same as event_callback_del(EVAS_CALLBACK_MOUSE_WHEEL, ...)
 
on_move_add(...)
Same as event_callback_add(EVAS_CALLBACK_MOVE, ...)
 
on_move_del(...)
Same as event_callback_del(EVAS_CALLBACK_MOVE, ...)
 
on_resize_add(...)
Same as event_callback_add(EVAS_CALLBACK_RESIZE, ...)
 
on_resize_del(...)
Same as event_callback_del(EVAS_CALLBACK_RESIZE, ...)
 
on_restack_add(...)
Same as event_callback_add(EVAS_CALLBACK_RESTACK, ...)
 
on_restack_del(...)
Same as event_callback_del(EVAS_CALLBACK_RESTACK, ...)
 
on_show_add(...)
Same as event_callback_add(EVAS_CALLBACK_SHOW, ...)
 
on_show_del(...)
Same as event_callback_del(EVAS_CALLBACK_SHOW, ...)
    Often unused
bool
anti_alias_get(...)
 
anti_alias_set(...)
Enable or disable the object to be drawn anti-aliased.
int
color_interpolation_get(...)
Return color interpolation being used by this object.
 
color_interpolation_set(...)
Set color interpolation to be used by this object.
int
pointer_mode_get(...)
 
pointer_mode_set(...)
How to deal with pointer events.
int
render_op_get(...)
Return the id of the operation used for rendering.
 
render_op_set(...)
Set the operation used for rendering.
Instance Variables [hide private]
  clipees
objects that this object clips.
  data
utility dict used to hold any user data.
  evas
Canvas that owns this object.
  name
object name or None.
  parent
Object that this object is member of, or None.
  rect
Rect describing object geometry, for easy manipulation.
  type
type name, ie: "rectangle".
    State manipulation
  clip
object's clipper.
  color
object's color as a tuple of int (r, g, b, a)
  visible
whenever it's visible or not.
    Positioning
  bottom_left
object's bottom-left corner coordinates.
  bottom_right
object's bottom-right corner coordinates.
  center
object's center coordinates.
  geometry
object's position and size.
  pos
object's position.
  size
object's size.
  top_left
object's top-left corner coordinates.
  top_right
object's top-right corner coordinates.
    Layer & Stack manipulation
  above
the object above this.
  below
the object below this.
  layer
object's layer number.
    Event processing control
  focus
whenever object currently have the focus.
  pass_events
whenever object should ignore and pass events.
  propagate_events
whenever object should propagate events to its parent.
  repeat_events
whenever object should process and then repeat events.
    Often unused
  anti_alias
if anti-aliased primitives should be used.
  color_interpolation
color interpolation used.
  pointer_mode
if pointer should be grabbed while processing events.
  render_op
render operation used at drawing.
Properties [hide private]
  bottom_center
  left_center
  right_center
  size_hint_align
Hint about alignment.
  size_hint_aspect
Hint about aspect.
  size_hint_max
Hint about maximum size.
  size_hint_min
Hint about minimum size.
  size_hint_padding
Hint about padding.
  size_hint_request
Hint about request size.
  size_hint_weight
Hint about weight.
  top_center

Inherited from object: __class__

Method Details [hide private]

__init__(...)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

__repr__(x)
(Representation operator)

 

repr(x)

Overrides: object.__repr__

__str__(x)
(Informal representation operator)

 

str(x)

Overrides: object.__str__

bottom_get(...)

 

Return the bottommost object. (Same as self.evas.bottom_get()).

Returns: Object

color_get(...)

 

Get object color (r, g, b, a) (uses pre-multiply colorspace!)

Returns: tuple of int
(r, g, b, a)

See Also: evas.color_argb_unpremul()

color_interpolation_get(...)

 

Return color interpolation being used by this object.

Returns: int
EVAS_COLOR_SPACE_ARGB or EVAS_COLOR_SPACE_AHSV.

color_set(...)

 

Set object color using r, g, b, a (uses pre-multiply colorspace!)

Note: You can convert non-premul to premul color space using evas.color_parse() or using specific function evas.color_argb_premul().

See Also: evas.color_parse(), evas.color_argb_premul().

delete(...)

 

Delete object and free it's internal (wrapped) resources.

Raises:
  • ValueError - if object already deleted.

Note: after this operation the object will be still alive in Python, but it will be shallow and every operation will have no effect (and may raise exceptions).

event_callback_add(...)

 

Add a new callback for the given event.

Raises:
  • ValueError - if type is unknown.
  • TypeError - if func is not callable.

event_callback_del(...)

 

Remove callback for the given event.

Raises:
  • ValueError - if type is unknown or if there was no func connected with this type.

Precondition: type and func must be used as parameter for event_callback_add().

name_set(...)

 

Set the name of one object.

Names have no great utility, you can use them to help debug or even to retrive them later by Canvas.object_name_find().

on_del_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_DEL, ...)

This is called before freeing object resources (see EVAS_CALLBACK_FREE).

Expected signature: function(object, *args, **kargs)

on_focus_in_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_FOCUS_IN, ...)

Expected signature: function(object, *args, **kargs)

on_focus_out_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_FOCUS_OUT, ...)

Expected signature: function(object, *args, **kargs)

on_free_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_FREE, ...)

This is called after freeing object resources (see EVAS_CALLBACK_DEL).

Expected signature: function(object, *args, **kargs)

on_hide_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_HIDE, ...)

Expected signature: function(object, *args, **kargs)

on_key_down_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_KEY_DOWN, ...)

Expected signature: function(object, event_info, *args, **kargs)

on_key_up_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_KEY_UP, ...)

Expected signature: function(object, event_info, *args, **kargs)

on_mouse_down_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_MOUSE_DOWN, ...)

Expected signature: function(object, event_info, *args, **kargs)

on_mouse_in_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_MOUSE_IN, ...)

Expected signature: function(object, event_info, *args, **kargs)

on_mouse_move_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_MOUSE_MOVE, ...)

Expected signature: function(object, event_info, *args, **kargs)

on_mouse_out_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_MOUSE_OUT, ...)

Expected signature: function(object, event_info, *args, **kargs)

on_mouse_up_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_MOUSE_UP, ...)

Expected signature: function(object, event_info, *args, **kargs)

on_mouse_wheel_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_MOUSE_WHEEL, ...)

Expected signature: function(object, event_info, *args, **kargs)

on_move_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_MOVE, ...)

Expected signature: function(object, *args, **kargs)

on_resize_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_RESIZE, ...)

Expected signature: function(object, *args, **kargs)

on_restack_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_RESTACK, ...)

Expected signature: function(object, *args, **kargs)

on_show_add(...)

 

Same as event_callback_add(EVAS_CALLBACK_SHOW, ...)

Expected signature: function(object, *args, **kargs)

pass_events_set(...)

 

Enable or disable event processing by this object.

If True, this will cause events on it to be ignored. They will be triggered on the next lower object (that is not set to pass events) instead.

Objects that pass events will also not be accounted in some operations unless explicitly required, like Canvas.top_at_xy_get(), Canvas.top_in_rectangle_get(), Canvas.objects_at_xy_get(), Canvas.objects_in_rectangle_get().

pointer_mode_set(...)

 

How to deal with pointer events.

This function has direct effect on event callbacks related to mouse.

If EVAS_OBJECT_POINTER_MODE_AUTOGRAB, then when mouse is down at this object, events will be restricted to it as source, mouse moves, for example, will be emitted even if outside this object area.

If EVAS_OBJECT_POINTER_MODE_NOGRAB, then events will be emitted just when inside this object area.

The default value is EVAS_OBJECT_POINTER_MODE_AUTOGRAB.

propagate_events_set(...)

 

Enable or disable propagation of events to parent.

If True, this will cause events on this object to propagate to its SmartObject parent, if it's a member of one.

repeat_events_set(...)

 

Enable or disable events to continue propagation after processed.

If True, this will cause events on it to be processed but then they will be triggered on the next lower object (that is not set to pass events).

size_hint_align_set(...)

 

Set hint for alignment.

This is a hint and not an enforcement. Accepted values are in the 0.0 to 1.0 range, with the special value -1.0 used to specify"justify" or "fill" by some users. See documentation of possible users.

When this property changes, EVAS_CALLBACK_CHANGED_SIZE_HINTS will be emitted.

size_hint_aspect_set(...)

 

Set hint for aspect.

This is a hint and not an enforcement. If aspect is EVAS_ASPECT_CONTROL_NONE (0), then it's disabled.

When this property changes, EVAS_CALLBACK_CHANGED_SIZE_HINTS will be emitted.

size_hint_max_set(...)

 

Set hint for maximum size.

This is a hint and not an enforcement. value -1 is disabled.

When this property changes, EVAS_CALLBACK_CHANGED_SIZE_HINTS will be emitted.

size_hint_min_set(...)

 

Set hint for minimum size.

This is a hint and not an enforcement. value 0 is disabled.

When this property changes, EVAS_CALLBACK_CHANGED_SIZE_HINTS will be emitted.

size_hint_padding_set(...)

 

Set hint for padding.

This is a hint and not an enforcement.

When this property changes, EVAS_CALLBACK_CHANGED_SIZE_HINTS will be emitted.

size_hint_request_set(...)

 

Set hint for request size.

This is a hint and not an enforcement. value 0 is disabled.

When this property changes, EVAS_CALLBACK_CHANGED_SIZE_HINTS will be emitted.

size_hint_weight_set(...)

 

Set hint for weight.

This is a hint and not an enforcement. Value 0.0 is disabled.

When this property changes, EVAS_CALLBACK_CHANGED_SIZE_HINTS will be emitted.

top_get(...)

 

Return the topmost object. (Same as self.evas.top_get()).

Returns: Object

Instance Variable Details [hide private]

rect

Rect describing object geometry, for easy manipulation. Changing this Rect will not affect current geometry, you have to set it again to have this behavior.

Property Details [hide private]

size_hint_align

Hint about alignment.

This is not an enforcement, just a hint that can be used by other objects like Edje, boxes, tables and others.

Accepted values are in the 0.0 to 1.0 range, with the special value -1.0 used to specify"justify" or "fill" by some users. See documentation of possible users.

When this property changes, EVAS_CALLBACK_CHANGED_SIZE_HINTS will be emitted.

size_hint_aspect

Hint about aspect.

This is not an enforcement, just a hint that can be used by other objects like Edje, boxes, tables and others.

Aspect EVAS_ASPECT_CONTROL_NONE is disabled.

When this property changes, EVAS_CALLBACK_CHANGED_SIZE_HINTS will be emitted.

size_hint_max

Hint about maximum size.

This is not an enforcement, just a hint that can be used by other objects like Edje, boxes, tables and others.

Value -1 is disabled.

When this property changes, EVAS_CALLBACK_CHANGED_SIZE_HINTS will be emitted.

size_hint_min

Hint about minimum size.

This is not an enforcement, just a hint that can be used by other objects like Edje, boxes, tables and others.

Value 0 is disabled.

When this property changes, EVAS_CALLBACK_CHANGED_SIZE_HINTS will be emitted.

size_hint_padding

Hint about padding.

This is not an enforcement, just a hint that can be used by other objects like Edje, boxes, tables and others.

When this property changes, EVAS_CALLBACK_CHANGED_SIZE_HINTS will be emitted.

size_hint_request

Hint about request size.

This is not an enforcement, just a hint that can be used by other objects like Edje, boxes, tables and others.

Value 0 is disabled.

When this property changes, EVAS_CALLBACK_CHANGED_SIZE_HINTS will be emitted.

size_hint_weight

Hint about weight.

This is not an enforcement, just a hint that can be used by other objects like Edje, boxes, tables and others.

Value 0.0 is disabled.

When this property changes, EVAS_CALLBACK_CHANGED_SIZE_HINTS will be emitted.