efl.evas.Canvas
Class¶efl.evas.
Canvas
(method=None, size=None, viewport=None)¶Canvas is the base drawing area and scene manager, it should have a number of objects (or actors) that will be managed. Object state is monitored and redraw is optimized based on changes.
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.
Attention
Canvas must be associated with an Input/Output system in
order to be functional. So far it’s impossible to do this
association directly from Python, so you should create Canvas
indirectly using efl.elementary
classes, like
efl.elementary.window.Window
.
Box
(**kargs)¶Factory of efl.evas.Box
associated with this
canvas.
FilledImage
(**kargs)¶Factory of efl.evas.FilledImage
associated with this
canvas.
Image
(**kargs)¶Factory of efl.evas.Image
associated with this
canvas.
Line
(**kargs)¶Factory of efl.evas.Line
associated with this
canvas.
Polygon
(**kargs)¶Factory of efl.evas.Polygon
associated with this
canvas.
Rectangle
(**kargs)¶Factory of efl.evas.Rectangle
associated with this
canvas.
Text
(**kargs)¶Factory of efl.evas.Text
associated with this
canvas.
Textblock
(**kargs)¶Factory of efl.evas.Textblock
associated with this
canvas.
bottom_get
()¶coord_screen_x_to_world
(x)¶int
coord_screen_y_to_world
(y)¶int
coord_world_x_to_screen
(x)¶int
coord_world_y_to_screen
(y)¶int
damage_rectangle_add
(x, y, w, h)¶delete
()¶engine_info_get
()¶Get the engine information pointer.
Note that given value is a pointer and is totally engine and platform dependent.
This call is very low level and is meant for extension to use, they usually do the machinery in C and just handle pointers as integers.
If in doubt, don’t mess with it.
pointer as integer (uintptr_t).
engine_info_set
(ptr)¶Set the engine information pointer.
Note that given value is a pointer, usually acquired with
engine_info_get()
and is totally engine and platform
dependent.
This call is very low level and is meant for extension to use, they usually do the machinery in C and just handle pointers as integers.
If in doubt, don’t mess with it.
event_callback_add
(type, func, *args, **kargs)¶Add a new callback for the given event.
type – an integer with event type code, like EVAS_CALLBACK_CANVAS_FOCUS_IN, EVAS_CALLBACK_RENDER_FLUSH_PRE and other EVAS_CALLBACK_ constants.
func –
function to call back, this function will have one of the following signatures:
function(object, event, *args, **kargs)
function(object, *args, **kargs)
The former is used by events that provide more data (none so far), while the second is used by events without. Parameters given at the end of event_callback_add() will be given to the callback. Note that the object passed to the callback in event parameter will only be valid during the callback, using it after callback returns will raise an ValueError.
ValueError – if type is unknown.
TypeError – if func is not callable.
event_callback_del
(type, func)¶Remove callback for the given event.
type – an integer with event type code.
func – function used with event_callback_add()
.
type and func must be used as parameter for
event_callback_add()
.
ValueError – if type is unknown or if there was no func connected with this type.
event_freeze
()¶Pause event propagation for this object.
event_freeze_count_get
()¶Get the event freeze count for this object.
the freeze count
int
event_thaw
()¶Restart event propagation for this object.
feed_hold
(hold, timestamp)¶Emit a feed_hold event in the canvas
feed_key_down
(*keyname, *key, *string, *compose, timestamp)¶Emit a key_down event in the canvas
feed_key_up
(*keyname, *key, *string, *compose, timestamp)¶Emit a key_up event in the canvas
feed_mouse_cancel
(timestamp)¶Emit a mouse_cancel event in the canvas
feed_mouse_down
(b, flags, timestamp)¶Emit a mouse_down event in the canvas
feed_mouse_in
(timestamp)¶Emit a mouse_in event in the canvas
feed_mouse_move
(x, y, timestamp)¶Emit a mouse_move event in the canvas
feed_mouse_out
(timestamp)¶Emit a mouse_out event in the canvas
feed_mouse_up
(b, flags, timestamp)¶Emit a mouse_up event in the canvas
feed_mouse_wheel
(direction, z, timestamp)¶Emit a mouse_wheel event in the canvas
feed_multi_down
(d, x, y, rad, radx, rady, pres, ang, fx, fy, flags, timestamp)¶Emit a multi_down event in the canvas
feed_multi_move
(d, x, y, rad, radx, rady, pres, ang, fx, fy, timestamp)¶Emit a multi_move event in the canvas
feed_multi_up
(d, x, y, rad, radx, rady, pres, ang, fx, fy, flags, timestamp)¶Emit a multi_up event in the canvas
focus_get
()¶font_available_list
()¶list of str
font_cache_flush
()¶font_cache_get
()¶int
font_cache_set
(value)¶font_hinting_can_hint
(flags)¶bool
font_hinting_get
()¶int
font_hinting_set
(flags)¶flags –
One of
EVAS_FONT_HINTING_NONE
EVAS_FONT_HINTING_AUTO
EVAS_FONT_HINTING_BYTECODE
font_path_append
(path)¶font_path_clear
()¶font_path_list
()¶list of str
font_path_prepend
(path)¶freeze
()¶Freeze event processing
freeze_get
()¶int
image_cache_flush
()¶image_cache_get
()¶int
image_cache_reload
()¶image_cache_set
(size)¶is_deleted
()¶Check if the object has been deleted thus leaving the object shallow.
True if the object has been deleted yet, False otherwise.
bool
key_modifier_is_set
(modifier)¶bool
norender
()¶object_name_find
(name)¶Find object by name.
name –
objects_at_xy_get
(x, y, include_pass_events_objects=False, include_hidden_objects=False)¶Get all children at (x, y).
x –
y –
include_pass_events_objects – if to include objects passing events.
include_hidden_objects – if to include hidden objects.
children objects.
List of efl.evas.Object
objects_in_rectangle_get
(x, y, w, h, include_pass_events_objects=False, include_hidden_objects=False)¶Get all children at given geometry.
x –
y –
w –
h –
include_pass_events_objects – if to include objects passing events.
include_hidden_objects – if to include hidden objects.
children objects.
List of efl.evas.Object
obscured_clear
()¶obscured_rectangle_add
(x, y, w, h)¶on_canvas_focus_in_add
(func, *a, **k)¶Same as event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_IN, …)
Expected signature:
function(object, *args, **kargs)
on_canvas_focus_in_del
(func)¶Same as event_callback_del(EVAS_CALLBACK_CANVAS_FOCUS_IN, …)
on_canvas_focus_out_add
(func, *a, **k)¶Same as event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_OUT, …)
Expected signature:
function(object, *args, **kargs)
on_canvas_focus_out_del
(func)¶Same as event_callback_del(EVAS_CALLBACK_CANVAS_FOCUS_OUT, …)
on_render_flush_post_add
(func, *a, **k)¶Same as event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_POST, …)
Expected signature:
function(object, *args, **kargs)
on_render_flush_post_del
(func)¶Same as event_callback_del(EVAS_CALLBACK_RENDER_FLUSH_POST, …)
on_render_flush_pre_add
(func, *a, **k)¶Same as event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_PRE, …)
Expected signature:
function(object, *args, **kargs)
on_render_flush_pre_del
(func)¶Same as event_callback_del(EVAS_CALLBACK_RENDER_FLUSH_PRE, …)
output_method_get
()¶output_method_set
(method)¶Set canvas render method, can be either a name or id.
method – name(str) or id(int) of the method to set
parent
¶The parent object
Eo
parent_get
()¶parent_set
(parent)¶Returns a bitmask with the mouse buttons currently pressed set to 1.
The least significant bit corresponds to the first mouse button (button 1) and the most significant bit corresponds to the last mouse button (button 32).
int
pointer_canvas_xy_get
()¶Returns the pointer’s (x, y) relative to canvas.
pointer_inside_get
()¶Returns whether the mouse pointer is logically inside the canvas.
bool
pointer_output_xy_get
()¶Returns the pointer’s (x, y) relative to output.
render
()¶Force canvas to redraw pending updates.
render_updates
()¶size_get
()¶the tuple of int: (w, h)
size_set
(w, h)¶Set canvas size.
w –
h –
thaw
()¶Thaw (unfreeze) event processing
top_at_pointer_get
()¶Get the topmost object at pointer position.
child object.
top_at_xy_get
(x, y, include_pass_events_objects=False, include_hidden_objects=False)¶Get the topmost object at (x, y).
x –
y –
include_pass_events_objects – if to include objects passing events.
include_hidden_objects – if to include hidden objects.
child object.
top_get
()¶top_in_rectangle_get
(x, y, w, h, include_pass_events_objects=False, include_hidden_objects=False)¶Get the topmost object at given geometry.
x –
y –
w –
h –
include_pass_events_objects – if to include objects passing events.
include_hidden_objects – if to include hidden objects.
child object.
viewport_get
()¶the tuple of int: (x, y, w, h)
viewport_set
(x, y, w, h)¶Sets the output viewport of the given evas in evas units.
x –
y –
w –
h –
The output viewport is the area of the evas that will be visible to the viewer. The viewport will be stretched to fit the output target of the evas when rendering is performed.
Note
The coordinate values do not have to map 1-to-1 with the output target. However, it is generally advised that it is done for ease of use.