enable.viewport module

Defines a Viewport which renders sub-areas of components

class enable.viewport.Viewport(**traits)[source]

Bases: enable.component.Component

A “window” or “view” into a sub-region of another component.

cleanup(window)[source]

When a window viewing or containing a component is destroyed, cleanup is called on the component to give it the opportunity to delete any transient state it may have (such as backbuffers).

component_to_viewport(x, y)[source]

Given a coordinate X and Y in the viewed component’s coordinate system, returns a coordinate in the coordinate system of the Viewport.

components_at(x, y, add_containers=False)[source]

Returns the list of components inside the viewport at the given (x,y) in the viewport’s native coordinate space (not in the space of the component it is viewing).

Although Viewports are not containers, they support this method.

get_event_transform(event=None, suffix='')[source]

Returns the 3x3 transformation matrix that this interactor will apply to the event (if any).

get_preferred_size()[source]

If we’re initiating layout, act like an OverlayPlotContainer, otherwise do the normal component action

invalidate_draw(damaged_regions=None, self_relative=False, view_relative=False)[source]

Invalidates any backbuffer that may exist, and notifies our parents and viewports of any damaged regions.

Call this method whenever a component’s internal state changes such that it must be redrawn on the next draw() call.

viewport_to_component(x, y)[source]

Given a coordinate X and Y in the viewport’s coordinate system, returns and X and Y in the coordinate system of the viewed component.