chaco.tools.better_selecting_zoom module

class chaco.tools.better_selecting_zoom.BetterSelectingZoom(component=None, *args, **kw)

Bases: chaco.abstract_overlay.AbstractOverlay, chaco.tools.better_zoom.BetterZoom

Zooming tool which allows the user to draw a box which defines the desired region to zoom in to

alpha = Union(Float(0.4), None)

The alpha value to apply to color when filling in the selection region. Because it is almost certainly useless to have an opaque zoom rectangle, but it’s also extremely useful to be able to use the normal named colors from Enable, this attribute allows the specification of a separate alpha value that replaces the alpha value of color at draw time.

always_on = Bool(False)

Is the tool always “on”? If True, left-clicking always initiates a zoom operation; if False, the user must press a key to enter zoom mode.

always_on_modifier = Enum("control", "shift", "alt")

Defines a meta-key, that works with always_on to set the zoom mode. This is useful when the zoom tool is used in conjunction with the pan tool.

border_color = ColorTrait("dodgerblue")

The color of the outside selection rectangle.

border_size = Int(1)

The thickness of selection rectangle border.

color = ColorTrait("lightskyblue")

The color of the selection box.

drag_button = Enum("left", "right", None)

The mouse button that initiates the drag. If “None”, then the tool will not respond to drag. (It can still respond to mousewheel events.)

enter_zoom_key = Instance(KeySpec, args=("z",))

The key press to enter zoom mode, if always_on is False. Has no effect if always_on is True.

event_state = Enum("normal", "selecting", "pre_selecting")

The possible event states of this zoom tool.

exit_zoom_key = Instance(KeySpec, args=("z",))

The key press to leave zoom mode, if always_on is False. Has no effect if always_on is True.

minimum_screen_delta = Int(10)

The minimum amount of screen space the user must select in order for the tool to actually take effect.

normal_key_pressed(event)

Handles a key being pressed when the tool is in the ‘normal’ state.

normal_left_down(event)

Handles the left mouse button being pressed while the tool is in the ‘normal’ state.

If the tool is enabled or always on, it starts selecting.

normal_right_down(event)

Handles the right mouse button being pressed while the tool is in the ‘normal’ state.

If the tool is enabled or always on, it starts selecting.

overlay(component, gc, view_bounds=None, mode='normal')

Draws this component overlaid on another component.

Overrides AbstractOverlay.

pointer = "magnifier"

The pointer to use when drawing a zoom box.

pre_selecting_key_pressed(event)

Handle key presses, specifically the exit zoom key

pre_selecting_left_down(event)

The user pressed the key to turn on the zoom mode, now handle the click to start the select mode

reset(event=None)

Resets the tool to normal state, with no start or end position.

selecting_key_pressed(event)

Handle key presses, specifically the exit zoom key

selecting_left_up(event)

Handles the left mouse button being released when the tool is in the ‘selecting’ state.

Finishes selecting and does the zoom.

selecting_mouse_leave(event)

Handles the mouse leaving the plot when the tool is in the ‘selecting’ state.

Ends the selection operation without zooming.

selecting_mouse_move(event)

Handles the mouse moving when the tool is in the ‘selecting’ state.

The selection is extended to the current mouse position.

selecting_right_up(event)

Handles the right mouse button being released when the tool is in the ‘selecting’ state.

Finishes selecting and does the zoom.

tool_mode = Enum("box", "range")

The selection mode:

range:

Select a range across a single index or value axis.

box:

Perform a “box” selection on two axes.