Methods
goocanvas.CanvasView.convert_from_item_space
def convert_from_item_space(item_view
, x
, y
)
item_view : | A goocanvas.CanvasItemView
|
x : | The x coordinate to convert. |
y : | The y coordinate to convert. |
Returns : | The new x and y coordinates. |
Converts a coordinate from the given item's coordinate space to the canvas view coordinate space,
applying all transformation matrices including the item's own transformation matrix, if it has one.
goocanvas.CanvasView.convert_from_pixel
def convert_from_pixel(x
, y
)
x : | The x coordinate to convert. |
y : | The y coordinate to convert. |
Returns : | The new x and y coordinates. |
Converts a coordinate from pixels to the canvas view coordinate space.
The pixel coordinate space specifies pixels from the top-left of the entire canvas window,
according to the current scale setting. See
set_scale
.
The canvas view coordinate space is specified in the call to
set_bounds
.
goocanvas.CanvasView.convert_to_item_space
def convert_to_item_space(item_view
, x
, y
)
item_view : | A goocanvas.CanvasItemView
|
x : | The x coordinate to convert. |
y : | The y coordinate to convert. |
Returns : | The new x and y coordinates. |
Converts a coordinate from the canvas view coordinate space to the given item's coordinate space,
applying all transformation matrices including the item's own transformation matrix, if it has one.
goocanvas.CanvasView.convert_to_pixel
def convert_to_pixel(x
, y
)
x : | The x coordinate to convert. |
y : | The y coordinate to convert. |
Returns : | The new x and y coordinates. |
Converts a coordinate from the canvas view coordinate space to pixels.
The canvas view coordinate space is specified in the call to
set_bounds
The pixel coordinate space specifies pixels from the top-left of the entire canvas window,
according to the current scale setting. See
set_scale
goocanvas.CanvasView.create_item_view
def create_item_view(item
, parent_view
)
item : | The the item to create a view for. |
parent_view : | The parent view of the new item. |
Returns : | A new item view. |
Creates a new item view for the given item, It emits the "item-view-created"
signal after creating the view, so application code can connect signal
handlers to the new view if desired.
goocanvas.CanvasView.get_item_view_at
def get_item_view_at(x
, y
, pointer_event
)
x : | The x coordinate of the point |
y : | The y coordinate of the point |
pointer_event : | True if the "pointer-events"
properties of items should be used to determine which parts
of the item are tested. |
Returns : | the item view found at the given point,
or None if no item view was found. |
Gets the item view at the given point.
goocanvas.CanvasView.get_model
def get_model()
Gets the model being displayed in the canvas.
goocanvas.CanvasView.get_scale
def get_scale()
Returns : | The current scale setting. |
Gets the current scale of the canvas, i.e. the number of pixels to use for each device unit.
goocanvas.CanvasView.grab_focus
def grab_focus(item_view
)
Grabs the keyboard focus for the given item.
goocanvas.CanvasView.keyboard_grab
def keyboard_grab(item_view
, owner_events
, time
)
item_view : | The item view to grab the keyword for. |
owner_events : | True if keyboard events for this application
will be reported normally, or False if all keyboard events will
be reported with respect to the grab item view. |
time : | The time of the event that lead to the keyboard grab.
This should come from the relevant
gtk.gdk.Event
|
Returns : | gtk.gdk.GRAB_SUCCESS if the grab succeeded. |
Grabs the keyboard focus for the given item.
goocanvas.CanvasView.keyboard_ungrab
def keyboard_grab(item_view
, time
)
item_view : | The item view that has the keyboard grab. |
time : | The time of the event that lead to the keyboard ungrab.
This should come from the relevant
gtk.gdk.Event
|
Ungrabs the pointer, if the given item view has the pointer grab.
goocanvas.CanvasView.pointer_grab
def pointer_grab(item_view
, event_mask
, cursor
, time
)
item_view : | The item view to grab the pointer for. |
event_mask : | The events to receive during the grab. |
cursor : | The cursor to display during the grab, or None .
|
time : | The time of the event that lead to the pointer grab.
This should come from the relevant
gtk.gdk.Event .
|
Returns : | gtk.gdk.GRAB_SUCCESS if the grab succeeded. |
Attempts to grab the pointer for the given item view.
goocanvas.CanvasView.pointer_ungrab
def pointer_ungrab(item_view
, time
)
item_view : | The item view that has the pointer grab. |
time : | The time of the event that lead to the pointer ungrab.
This should come from the relevant
gtk.gdk.Event
|
Ungrabs the pointer, if the given item view has the pointer grab.
goocanvas.CanvasView.render
def render(cr
, bounds
, scale
)
cr : | A cairo context. |
bounds : | The area to render, or None
to render the entire canvas. |
scale : | 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
to goocanvas.ITEM_VISIBLE_ABOVE_THRESHOLD. |
Renders all or part of a canvas to the given cairo context.
goocanvas.CanvasView.request_redraw
def request_redraw(bounds
)
bounds : | The bounds to redraw. |
Requests that the given bounds be redrawn.
goocanvas.CanvasView.request_update
def request_update()
Schedules an update of the
goocanvas.CanvasView
.
This will be performed in the idle loop, after all pending events have been handled,
but before the canvas has been repainted.
goocanvas.CanvasView.scroll_to
def scroll_to(left
, top
)
left : | The x coordinate to scroll to. |
top : | The y coordinate to scroll to. |
Scrolls the canvas, placing the given point as close to the top-left of
the view as possible.
goocanvas.CanvasView.set_bounds
def set_bounds(left
, top
, right
, bottom
)
left : | The left edge. |
top : | The top edge. |
right : | The right edge. |
bottom : | The bottom edge. |
Sets the bounds of the
goocanvas.CanvasView
in device units. By default, device units are the same as pixels, though
set_scale
can be used to specify a different scale.
goocanvas.CanvasView.set_model
def set_model(model
)
Sets the model to be displayed in the
goocanvas.CanvasView
.
A hierarchy of item views will be created, corresponding to the hierarchy of items in the model.
goocanvas.CanvasView.set_scale
def set_scale(pixel_per_unit
)
pixel_per_unit : | The new scale setting. |
Sets the current scale of the canvas, i.e. the number of pixels to use for each device unit.
goocanvas.CanvasView.update
def update()
Updates any item views that need updating.
This is only intended to be used by subclasses of
goocanvas.CanvasView
or
goocanvas.CanvasItemView
implementation. If the bounds of items change, they will request a redraw of the old and
new bounds so the display is updated correctly.