chaco.tools.better_zoom module

class chaco.tools.better_zoom.BetterZoom(component=None, **traits)

Bases: enable.base_tool.BaseTool, chaco.tools.tool_history_mixin.ToolHistoryMixin

axis = Enum("both", "index", "value")

The axis to which the selection made by this tool is perpendicular. This only applies in ‘range’ mode.

enable_wheel = Bool(True)

Enable the mousewheel for zooming?

keys_zoom_to_mouse = Bool(True)

if the mouse pointer should be used to control the center of the zoom action even for key events based zoom

next_state_key = Instance(KeySpec, args=("y", "control"))

Key to go to the next state in the history.

normal_key_pressed(event)

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

normal_mouse_enter(event)

Try to set the focus to the window when the mouse enters, otherwise the keypress events will not be triggered.

normal_mouse_move(event)
normal_mouse_wheel(event)
position = Tuple(Float, Float)

: the position to zoom on (usually the mouse location)

prev_state_key = Instance(KeySpec, args=("z", "control"))

Key to go to the previous state in the history.

x_max_zoom_factor = Float(1e5)

The maximum ratio between the original data space bounds and the zoomed-in data space bounds. If No limit is desired, set to inf

x_min_zoom_factor = Float(1e-5)

The maximum ratio between the zoomed-out data space bounds and the original bounds. If No limit is desired, set to -inf

zoom_factor = Float(2.0)

The amount to zoom in by. The zoom out will be inversely proportional

zoom_in(factor=0)
zoom_in_key = Instance(KeySpec, args=("+",), kw={"ignore": ["shift"]})

Keys to zoom in/out

zoom_in_x(factor=0)
zoom_in_x_key = Instance(KeySpec, args=("Right", "shift"))

Keys to zoom in/out in x direction only

zoom_in_y(factor=0)
zoom_in_y_key = Instance(KeySpec, args=("Up", "shift"))

Keys to zoom in/out in y direction only

zoom_out(factor=0)
zoom_out_x(factor=0)
zoom_out_y(factor=0)
zoom_to_mouse = Bool(True)

if the mouse pointer should be used to control the center of the zoom action