GooCanvas.Canvas¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Scrollable (9)
- Structs:
Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Gtk.Scrollable (1)
|
|
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
Where to place the canvas when it is smaller than the widget’s allocated area |
||
r/w |
If the bounds are automatically calculated based on the bounds of all the items in the canvas |
||
w |
The color to use for the canvas background |
||
w |
The color to use for the canvas background, specified as a |
||
w |
The color to use for the canvas background, specified as a 24-bit integer value, 0xRRGGBB |
||
r/w |
If the automatic bounds are calculated from the origin |
||
r/w |
The padding added to the automatic bounds |
||
r/w |
If the background is cleared before the canvas is painted |
||
r/w |
If all item layout is done to the nearest integer |
||
r/w |
If the canvas is completely redrawn when scrolled, to reduce the flicker of static items. Note that since GTK+ 3.0 the canvas is always redrawn when scrolled, so this option has no effect. |
||
r/w |
The horizontal resolution of the display, in dots per inch |
||
r/w |
The vertical resolution of the display, in dots per inch |
||
r/w |
The magnification factor of the canvas |
||
r/w |
The horizontal magnification factor of the canvas |
||
r/w |
The vertical magnification factor of the canvas |
||
r/w |
The units to use for the canvas |
||
r/w |
The x coordinate of the left edge of the canvas bounds, in canvas units |
||
r/w |
The x coordinate of the right edge of the canvas bounds, in canvas units |
||
r/w |
The y coordinate of the top edge of the canvas bounds, in canvas units |
||
r/w |
The y coordinate of the bottom edge of the canvas bounds, in canvas units |
Style Properties¶
- Inherited:
Signals¶
- Inherited:
Name |
Short Description |
---|---|
This is emitted when a new canvas item is created, in model/view mode. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
anchor |
r |
||
automatic_bounds |
r |
||
before_initial_draw |
r |
||
bounds |
r |
||
bounds_from_origin |
r |
||
bounds_padding |
r |
||
canvas_window |
r |
||
canvas_x_offset |
r |
||
canvas_y_offset |
r |
||
clear_background |
r |
||
container |
r |
||
crossing_event |
r |
||
device_to_pixels_x |
r |
||
device_to_pixels_y |
r |
||
focused_item |
r |
||
freeze_count |
r |
||
hadjustment |
r |
||
hscroll_policy |
r |
||
idle_id |
r |
||
integer_layout |
r |
||
keyboard_grab_item |
r |
||
model_to_item |
r |
||
need_entire_subtree_update |
r |
||
need_update |
r |
||
pointer_grab_button |
r |
||
pointer_grab_initial_item |
r |
||
pointer_grab_item |
r |
||
pointer_item |
r |
||
redraw_when_scrolled |
r |
||
resolution_x |
r |
||
resolution_y |
r |
||
root_item |
r |
||
root_item_model |
r |
||
scale |
r |
||
scale_x |
r |
||
scale_y |
r |
||
tmp_window |
r |
||
units |
r |
||
vadjustment |
r |
||
vscroll_policy |
r |
||
widget_items |
[ |
r |
Class Details¶
- class GooCanvas.Canvas(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
GooCanvas.Canvas
is the main widget containing a number of canvas items.Here is a
GooCanvas.simple
example:<informalexample><programlisting> #include <goocanvas.h>
static
bool
on_rect_button_press (GooCanvas.CanvasItem
*view,GooCanvas.CanvasItem
*target,Gdk.EventButton
*event,object
data);int main (int argc,
str
*argv[]) {Gtk.Widget
*window, *scrolled_win, *canvas;GooCanvas.CanvasItem
*root, *rect_item, *text_item;/* Initialize GTK+. */
Gtk.init
(&argc, &argv);/* Create the window and widgets. */ window =
Gtk.Window.new
(Gtk.WindowType.TOPLEVEL
);Gtk.Window.set_default_size
(GTK_WINDOW (window), 640, 600);Gtk.Widget.show
(window); g_signal_connect (window, “delete_event”, G_CALLBACK (on_delete_event),None
);scrolled_win =
Gtk.ScrolledWindow.new
(None
,None
);Gtk.ScrolledWindow.set_shadow_type
(GTK_SCROLLED_WINDOW (scrolled_win),Gtk.ShadowType.IN
);Gtk.Widget.show
(scrolled_win);Gtk.Container.add
(GTK_CONTAINER (window), scrolled_win);canvas =
GooCanvas.Canvas.new
();Gtk.Widget.set_size_request
(canvas, 600, 450);GooCanvas.Canvas.set_bounds
(GOO_CANVAS (canvas), 0, 0, 1000, 1000);Gtk.Widget.show
(canvas);Gtk.Container.add
(GTK_CONTAINER (scrolled_win), canvas);root =
GooCanvas.Canvas.get_root_item
(GOO_CANVAS (canvas));/* Add a few
GooCanvas.simple
items. */ rect_item = goo_canvas_rect_new (root, 100, 100, 400, 400, “line-width”, 10.0, “radius-x”, 20.0, “radius-y”, 10.0, “stroke-color”, “yellow”, “fill-color”, “red”,None
);text_item = goo_canvas_text_new (root, “Hello World”, 300, 300, -1,
GooCanvas.CanvasAnchorType.CENTER
, “font”, “Sans 24”,None
);GooCanvas.CanvasItem.rotate
(text_item, 45, 300, 300);/* Connect a signal handler for the rectangle item. */ g_signal_connect (rect_item, “button_press_event”, G_CALLBACK (on_rect_button_press),
None
);/* Pass control to the GTK+ main event loop. */
Gtk.main
();return 0; }
/* This handles button presses in item views. We simply output a message to the console. */ static
bool
on_rect_button_press (GooCanvas.CanvasItem
*item,GooCanvas.CanvasItem
*target,Gdk.EventButton
*event,object
data) { g_print (“rect item received button press event\n”); returnTrue
; }</programlisting></informalexample>
A
GooCanvas.Canvas
widget is usually placed inside aGtk.ScrolledWindow
widget and can be scrolled with the scrollbar or with the scroll wheel on a mouse. To disable mouse wheel scrolling, do this: <informalexample><programlisting> g_signal_connect (canvas, “scroll-event”, G_CALLBACK (Gtk.true
),None
); </programlisting></informalexample>- classmethod create_path(commands, cr)¶
- Parameters:
commands ([
GooCanvas.CanvasPathCommand
]) – an array ofGooCanvas.CanvasPathCommand
.cr (
cairo.Context
) – a cairo context.
Creates the path specified by the given
GooCanvas.CanvasPathCommand
array.
- classmethod marshal_BOOLEAN__BOXED(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)¶
- Parameters:
closure (
GObject.Closure
) –return_value (
GObject.Value
) –n_param_values (
int
) –param_values (
GObject.Value
) –
- classmethod marshal_BOOLEAN__DOUBLE_DOUBLE_BOOLEAN_OBJECT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)¶
- Parameters:
closure (
GObject.Closure
) –return_value (
GObject.Value
) –n_param_values (
int
) –param_values (
GObject.Value
) –
- classmethod marshal_BOOLEAN__OBJECT_BOXED(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)¶
- Parameters:
closure (
GObject.Closure
) –return_value (
GObject.Value
) –n_param_values (
int
) –param_values (
GObject.Value
) –
- classmethod marshal_VOID__INT_INT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)¶
- Parameters:
closure (
GObject.Closure
) –return_value (
GObject.Value
) –n_param_values (
int
) –param_values (
GObject.Value
) –
- classmethod marshal_VOID__OBJECT_OBJECT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)¶
- Parameters:
closure (
GObject.Closure
) –return_value (
GObject.Value
) –n_param_values (
int
) –param_values (
GObject.Value
) –
- classmethod new()¶
- Returns:
a new
GooCanvas.Canvas
widget.- Return type:
Creates a new
GooCanvas.Canvas
widget.A
GooCanvas.CanvasGroup
is created automatically as the root item of the canvas, though this can be overriden withGooCanvas.Canvas.set_root_item
() orGooCanvas.Canvas.set_root_item_model
().
- classmethod parse_path_data(path_data)¶
- Parameters:
path_data (
str
) –the sequence of path commands, specified as a string using the same syntax as in the `Scalable
Vector Graphics (SVG) <http://www.w3.org/Graphics/SVG/>`__ path element.
- Returns:
a
GLib.Array
ofGooCanvas.CanvasPathCommand
elements.- Return type:
Parses the given SVG path specification string.
- convert_bounds_to_item_space(item, bounds)¶
- Parameters:
item (
GooCanvas.CanvasItem
) – aGooCanvas.CanvasItem
.bounds (
GooCanvas.CanvasBounds
) – the bounds in canvas coordinate space, to be converted.
Converts the given bounds in the canvas coordinate space to a bounding box in item space. This is useful in the item paint() methods to convert the bounds to be painted to the item’s coordinate space.
- convert_from_item_space(item, x, y)¶
- Parameters:
item (
GooCanvas.CanvasItem
) – aGooCanvas.CanvasItem
.x (
float
) – a pointer to the x coordinate to convert.y (
float
) – a pointer to the y coordinate to convert.
- Returns:
- x:
a pointer to the x coordinate to convert.
- y:
a pointer to the y coordinate to convert.
- Return type:
Converts a coordinate from the given item’s coordinate space to the canvas coordinate space, applying all transformation matrices including the item’s own transformation matrix, if it has one.
- convert_from_pixels(x, y)¶
- Parameters:
- Returns:
- x:
a pointer to the x coordinate to convert.
- y:
a pointer to the y coordinate to convert.
- Return type:
Converts a coordinate from pixels to the canvas coordinate space.
The pixel coordinate space specifies pixels from the top-left of the entire canvas window, according to the current scale setting. See
GooCanvas.Canvas.set_scale
().The canvas coordinate space is specified in the call to
GooCanvas.Canvas.set_bounds
().
- convert_to_item_space(item, x, y)¶
- Parameters:
item (
GooCanvas.CanvasItem
) – aGooCanvas.CanvasItem
.x (
float
) – a pointer to the x coordinate to convert.y (
float
) – a pointer to the y coordinate to convert.
- Returns:
- x:
a pointer to the x coordinate to convert.
- y:
a pointer to the y coordinate to convert.
- Return type:
Converts a coordinate from the canvas coordinate space to the given item’s coordinate space, applying all transformation matrices including the item’s own transformation matrix, if it has one.
- convert_to_pixels(x, y)¶
- Parameters:
- Returns:
- x:
a pointer to the x coordinate to convert.
- y:
a pointer to the y coordinate to convert.
- Return type:
Converts a coordinate from the canvas coordinate space to pixels.
The canvas coordinate space is specified in the call to
GooCanvas.Canvas.set_bounds
().The pixel coordinate space specifies pixels from the top-left of the entire canvas window, according to the current scale setting. See
GooCanvas.Canvas.set_scale
().
- convert_units_from_pixels(x, y)¶
- Parameters:
- Returns:
- x:
a pointer to the x coordinate to convert.
- y:
a pointer to the y coordinate to convert.
- Return type:
Converts a coordinate from pixels to the canvas’s units, ignoring scaling and ignoring the coordinate space specified in the call to
GooCanvas.Canvas.set_bounds
().New in version 2.0.1.
- convert_units_to_pixels(x, y)¶
- Parameters:
- Returns:
- x:
a pointer to the x coordinate to convert.
- y:
a pointer to the y coordinate to convert.
- Return type:
Converts a coordinate from the canvas’s units to pixels, ignoring scaling and ignoring the coordinate space specified in the call to
GooCanvas.Canvas.set_bounds
().New in version 2.0.1.
- create_cairo_context()¶
- Returns:
a new cairo context. It should be freed with cairo_destroy().
- Return type:
Creates a cairo context, initialized with the default canvas settings. Note that this context should not be used for drawing. It should only be used for calculating bounds of items.
- create_item(model)¶
- Parameters:
model (
GooCanvas.CanvasItemModel
) – the item model to create a canvas item for.- Returns:
a new canvas item.
- Return type:
This function is only intended to be used when implementing new canvas items, typically container items such as
GooCanvas.CanvasGroup
.It creates a new canvas item for the given item model, and recursively creates items for any children.
It uses the create_item() virtual method if it has been set. Subclasses of
GooCanvas.Canvas
can define this method if they want to use custom views for items.It emits the
GooCanvas.Canvas
::item-created
signal after creating the view, so application code can connect signal handlers to the new view if desired.
- get_bounds()¶
- Returns:
- Return type:
Gets the bounds of the canvas, in canvas units.
By default, canvas units are pixels, though the
GooCanvas.Canvas
:units
property can be used to change the units to points, inches or millimeters.
- get_default_line_width()¶
- Returns:
the default line width of the canvas.
- Return type:
Gets the default line width, which depends on the current units setting.
- get_item(model)¶
- Parameters:
model (
GooCanvas.CanvasItemModel
) – aGooCanvas.CanvasItemModel
.- Returns:
the canvas item corresponding to the given
GooCanvas.CanvasItemModel
, orNone
if no canvas item has been created for it yet.- Return type:
Gets the canvas item associated with the given
GooCanvas.CanvasItemModel
. This is only useful whenGooCanvas.Canvas.set_root_item_model
() has been used to set a model for the canvas.For
GooCanvas.simple
applications you can useGooCanvas.Canvas.get_item
() to set up signal handlers for your items, e.g.item = goo_canvas_get_item (GOO_CANVAS (canvas), my_item); g_signal_connect (item, "button_press_event", (GtkSignalFunc) on_my_item_button_press, NULL);
More complex applications may want to use the
GooCanvas.Canvas
::item-created
signal to hook up their signal handlers.
- get_item_at(x, y, is_pointer_event)¶
- Parameters:
- Returns:
the item found at the given point, or
None
if no item was found.- Return type:
Gets the item at the given point.
- get_items_at(x, y, is_pointer_event)¶
- Parameters:
- Returns:
a list of items found at the given point, with the top item at the start of the list, or
None
if no items were found. The list must be freed with g_list_free().- Return type:
Gets all items at the given point.
- get_items_in_area(area, inside_area, allow_overlaps, include_containers)¶
- Parameters:
area (
GooCanvas.CanvasBounds
) – the area to compare with each item’s bounds.inside_area (
bool
) –True
if items inside area should be returned, orFalse
if items outside area should be returned.allow_overlaps (
bool
) –True
if items which are partly inside and partly outside should be returned.include_containers (
bool
) –True
if containers should be checked as well as normal items.
- Returns:
a list of items in the given area, or
None
if no items are found. The list should be freed with g_list_free().- Return type:
Gets a list of items inside or outside a given area.
- get_root_item()¶
- Returns:
the root item, or
None
if there is no root item.- Return type:
Gets the root item of the canvas, usually a
GooCanvas.CanvasGroup
.
- get_root_item_model()¶
- Returns:
the root item model, or
None
if there is no root item model.- Return type:
Gets the root item model of the canvas.
- get_scale()¶
- Returns:
the current scale setting.
- Return type:
Gets the current scale of the canvas.
The scale specifies the magnification factor of the canvas, e.g. if an item has a width of 2 pixels and the scale is set to 3, it will be displayed with a width of 2 x 3 = 6 pixels.
- get_static_root_item()¶
- Returns:
the static root item, or
None
.- Return type:
Gets the static root item of the canvas.
Static items are exactly the same as ordinary canvas items, except that they do not move or change size when the canvas is scrolled or the scale changes.
Static items are added to the static root item in exactly the same way that ordinary items are added to the root item.
- get_static_root_item_model()¶
- Returns:
the static root item model, or
None
.- Return type:
Gets the static root item model of the canvas.
Static item models are exactly the same as ordinary item models, except that the corresponding items do not move or change size when the canvas is scrolled or the scale changes.
Static items models are added to the static root item model in exactly the same way that ordinary item models are added to the root item model.
- grab_focus(item)¶
- Parameters:
item (
GooCanvas.CanvasItem
) – the item to grab the focus.
Grabs the keyboard focus for the given item.
- keyboard_grab(item, owner_events, time)¶
- Parameters:
item (
GooCanvas.CanvasItem
) – the item to grab the keyboard for.owner_events (
bool
) –True
if keyboard events for this application will be reported normally, orFalse
if all keyboard events will be reported with respect to the grab item.time (
int
) – the time of the event that lead to the keyboard grab. This should come from the relevantGdk.Event
.
- Returns:
Gdk.GrabStatus.SUCCESS
if the grab succeeded.- Return type:
Attempts to grab the keyboard for the given item.
- keyboard_ungrab(item, time)¶
- Parameters:
item (
GooCanvas.CanvasItem
) – the item that has the keyboard grab.time (
int
) – the time of the event that lead to the keyboard ungrab. This should come from the relevantGdk.Event
.
Ungrabs the keyboard, if the given item has the keyboard grab.
- pointer_grab(item, event_mask, cursor, time)¶
- Parameters:
item (
GooCanvas.CanvasItem
) – the item to grab the pointer for.event_mask (
Gdk.EventMask
) – the events to receive during the grab.cursor (
Gdk.Cursor
) – the cursor to display during the grab, orNone
.time (
int
) – the time of the event that lead to the pointer grab. This should come from the relevantGdk.Event
.
- Returns:
Gdk.GrabStatus.SUCCESS
if the grab succeeded.- Return type:
Attempts to grab the pointer for the given item.
- pointer_ungrab(item, time)¶
- Parameters:
item (
GooCanvas.CanvasItem
) – the item that has the grab.time (
int
) – the time of the event that lead to the pointer ungrab. This should come from the relevantGdk.Event
.
Ungrabs the pointer, if the given item has the pointer grab.
- register_widget_item(witem)¶
- Parameters:
witem (
GooCanvas.CanvasWidget
) – aGooCanvas.CanvasWidget
item.
This function should only be used by
GooCanvas.CanvasWidget
and subclass implementations.It registers a widget item with the canvas, so that the canvas can do the necessary actions to move and resize the widget as needed.
- render(cr, bounds, scale)¶
- Parameters:
cr (
cairo.Context
) – a cairo context.bounds (
GooCanvas.CanvasBounds
orNone
) – the area to render, orNone
to render the entire canvas.scale (
float
) – the scale to compare with each item’s visibility threshold to see if they should be rendered. This only affects items that have their visibility set toGooCanvas.CanvasItemVisibility.VISIBLE_ABOVE_THRESHOLD
.
Renders all or part of a canvas to the given cairo context.
This example code could be used in a
Gtk.PrintOperation
Gtk.PrintOperation
::draw-page
callback to print each page in a multi-page document (assuming the pages appear one after the other vertically in the canvas). Note the call tocairo.Context.translate
() to translate the output to the correct position on the printed page.<informalexample><programlisting>
GooCanvas.CanvasBounds
bounds; bounds.x1 = 0; bounds.x2 = A4_PAGE_WIDTH; bounds.y1 = A4_PAGE_HEIGHT * page_num; bounds.y2 = A4_PAGE_HEIGHT * (page_num + 1);cr =
Gtk.PrintContext.get_cairo_context
(print_context);cairo.Context.translate
(cr, 0, -A4_PAGE_HEIGHT * page_num);GooCanvas.Canvas.render
(GOO_CANVAS (canvas), cr, &bounds, 0.0); </programlisting></informalexample>
- request_item_redraw(bounds, is_static)¶
- Parameters:
bounds (
GooCanvas.CanvasBounds
) – the bounds of the item to redraw.is_static (
bool
) – if the item is static.
This function is only intended to be used by subclasses of
GooCanvas.Canvas
orGooCanvas.CanvasItem
implementations.Requests that the given bounds be redrawn. If is_static is
True
the bounds are assumed to be in the static item coordinate space, otherwise they are assumed to be in the canvas coordinate space.If is_static is
False
this function behaves the same asGooCanvas.Canvas.request_redraw
().
- request_redraw(bounds)¶
- Parameters:
bounds (
GooCanvas.CanvasBounds
) – the bounds to redraw, in device space.
This function is only intended to be used by subclasses of
GooCanvas.Canvas
orGooCanvas.CanvasItem
implementations.Requests that the given bounds be redrawn. The bounds must be in the canvas coordinate space.
- request_update()¶
This function is only intended to be used by subclasses of
GooCanvas.Canvas
orGooCanvas.CanvasItem
implementations.It schedules an update of the
GooCanvas.Canvas
. This will be performed in the idle loop, after all pending events have been handled, but before the canvas has been repainted.
- scroll_to(left, top)¶
- Parameters:
Scrolls the canvas, placing the given point as close to the top-left of the view as possible.
- set_bounds(left, top, right, bottom)¶
- Parameters:
Sets the bounds of the
GooCanvas.Canvas
, in canvas units.By default, canvas units are pixels, though the
GooCanvas.Canvas
:units
property can be used to change the units to points, inches or millimeters.
- set_root_item(item)¶
- Parameters:
item (
GooCanvas.CanvasItem
) – the root canvas item.
Sets the root item of the canvas. Any existing canvas items are removed.
- set_root_item_model(model)¶
- Parameters:
model (
GooCanvas.CanvasItemModel
) – aGooCanvas.CanvasItemModel
.
Sets the root item model of the canvas.
A hierarchy of canvas items will be created, corresponding to the hierarchy of items in the model. Any current canvas items will be removed.
- set_scale(scale)¶
- Parameters:
scale (
float
) – the new scale setting.
Sets the scale of the canvas.
The scale specifies the magnification factor of the canvas, e.g. if an item has a width of 2 pixels and the scale is set to 3, it will be displayed with a width of 2 x 3 = 6 pixels.
- set_static_root_item(item)¶
- Parameters:
item (
GooCanvas.CanvasItem
) – the static root item.
Sets the static root item. Any existing static items are removed.
Static items are exactly the same as ordinary canvas items, except that they do not move or change size when the canvas is scrolled or the scale changes.
Static items are added to the static root item in exactly the same way that ordinary items are added to the root item.
- set_static_root_item_model(model)¶
- Parameters:
model (
GooCanvas.CanvasItemModel
) – the static root item model.
Sets the static root item model. Any existing static item models are removed.
Static item models are exactly the same as ordinary item models, except that the corresponding items do not move or change size when the canvas is scrolled or the scale changes.
Static items models are added to the static root item model in exactly the same way that ordinary item models are added to the root item model.
- unregister_item(model)¶
- Parameters:
model (
GooCanvas.CanvasItemModel
) – the item model whose canvas item is being finalized.
This function is only intended to be used when implementing new canvas items.
It should be called in the finalize method of
GooCanvas.CanvasItem
objects, to remove the canvas item from theGooCanvas.Canvas
's hash table.
- unregister_widget_item(witem)¶
- Parameters:
witem (
GooCanvas.CanvasWidget
) – aGooCanvas.CanvasWidget
item.
This function should only be used by
GooCanvas.CanvasWidget
and subclass implementations.It unregisters a widget item from the canvas, when the item is no longer in the canvas.
- update()¶
This function is only intended to be used by subclasses of
GooCanvas.Canvas
orGooCanvas.CanvasItem
implementations.It updates any items that need updating.
If the bounds of items change, they will request a redraw of the old and new bounds so the display is updated correctly.
- do_create_item(model) virtual¶
- Parameters:
model (
GooCanvas.CanvasItemModel
) – the item model to create a canvas item for.- Returns:
a new canvas item.
- Return type:
This function is only intended to be used when implementing new canvas items, typically container items such as
GooCanvas.CanvasGroup
.It creates a new canvas item for the given item model, and recursively creates items for any children.
It uses the create_item() virtual method if it has been set. Subclasses of
GooCanvas.Canvas
can define this method if they want to use custom views for items.It emits the
GooCanvas.Canvas
::item-created
signal after creating the view, so application code can connect signal handlers to the new view if desired.
- do_item_created(item, model) virtual¶
- Parameters:
item (
GooCanvas.CanvasItem
) –model (
GooCanvas.CanvasItemModel
) –
signal emitted when a new canvas item has been created. Applications can connect to this to setup signal handlers for the new item.
Signal Details¶
- GooCanvas.Canvas.signals.item_created(canvas, item, model)¶
- Signal Name:
item-created
- Flags:
- Parameters:
canvas (
GooCanvas.Canvas
) – The object which received the signalitem (
GooCanvas.CanvasItem
) – the new item.model (
GooCanvas.CanvasItemModel
) – the item’s model.
This is emitted when a new canvas item is created, in model/view mode.
Applications can set up signal handlers for the new items here.
Property Details¶
- GooCanvas.Canvas.props.anchor¶
- Name:
anchor
- Type:
- Default Value:
- Flags:
Where to place the canvas when it is smaller than the widget’s allocated area
- GooCanvas.Canvas.props.automatic_bounds¶
-
If the bounds are automatically calculated based on the bounds of all the items in the canvas
- GooCanvas.Canvas.props.background_color¶
-
The color to use for the canvas background
- GooCanvas.Canvas.props.background_color_gdk_rgba¶
-
The color to use for the canvas background, specified as a
Gdk.RGBA
.New in version 2.0.1.
- GooCanvas.Canvas.props.background_color_rgb¶
-
The color to use for the canvas background, specified as a 24-bit integer value, 0xRRGGBB
- GooCanvas.Canvas.props.bounds_from_origin¶
-
If the automatic bounds are calculated from the origin
- GooCanvas.Canvas.props.bounds_padding¶
-
The padding added to the automatic bounds
- GooCanvas.Canvas.props.clear_background¶
-
If the background is cleared before the canvas is painted
- GooCanvas.Canvas.props.integer_layout¶
-
If all item layout is done to the nearest integer
- GooCanvas.Canvas.props.redraw_when_scrolled¶
-
If the canvas is completely redrawn when scrolled, to reduce the flicker of static items. Note that since GTK+ 3.0 the canvas is always redrawn when scrolled, so this option has no effect.
- GooCanvas.Canvas.props.resolution_x¶
-
The horizontal resolution of the display, in dots per inch
- GooCanvas.Canvas.props.resolution_y¶
-
The vertical resolution of the display, in dots per inch
- GooCanvas.Canvas.props.scale¶
-
The magnification factor of the canvas
- GooCanvas.Canvas.props.scale_x¶
-
The horizontal magnification factor of the canvas
- GooCanvas.Canvas.props.scale_y¶
-
The vertical magnification factor of the canvas
- GooCanvas.Canvas.props.units¶
- Name:
units
- Type:
- Default Value:
- Flags:
The units to use for the canvas
- GooCanvas.Canvas.props.x1¶
-
The x coordinate of the left edge of the canvas bounds, in canvas units
- GooCanvas.Canvas.props.x2¶
-
The x coordinate of the right edge of the canvas bounds, in canvas units
- GooCanvas.Canvas.props.y1¶
-
The y coordinate of the top edge of the canvas bounds, in canvas units