chaco.tools.pan_tool module

Defines the PanTool class.

class chaco.tools.pan_tool.PanTool(component=None, **traits)

Bases: enable.base_tool.BaseTool

A tool that enables the user to pan a plot by clicking a mouse button and dragging.

constrain = Bool(False)

Constrain the panning to one direction?

constrain_direction = Enum(None, "x", "y")

The direction of constrained draw. A value of None means that the user has initiated the drag and pressed the constrain_key, but hasn’t moved the mouse yet; the magnitude of the components of the next mouse_move event will determine the constrain_direction.

constrain_key = Enum(None, "shift", "control", "alt")

The modifier key that, if depressed when the drag is initiated, constrains the panning to happen in the only direction of largest initial motion. It is possible to permanently restrict this tool to always drag along one direction. To do so, set constrain=True, constrain_key=None, and constrain_direction to the desired direction.

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

The mouse button that initiates the drag operation.

drag_pointer = Pointer("hand")

The cursor to use when panning.

draw_mode = "none"

The tool does not have a visual representation (overrides BaseTool).

event_state = Enum("normal", "panning")

The possible event states of this tool (overrides enable.Interactor).

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 when the tool is in the ‘normal’ state.

Starts panning if the left mouse button is the drag button.

normal_middle_down(event)

Handles the middle mouse button being pressed when the tool is in the ‘normal’ state.

Starts panning if the middle mouse button is the drag button.

normal_right_down(event)

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

Starts panning if the right mouse button is the drag button.

pan_keys_step = Float(0.0)

number of pixels the keys should pan disabled if 0.0

pan_right_key = Instance(KeySpec, args=("Right",))

Keys to Pan via keyboard

panning_left_up(event)

Handles the left mouse button coming up when the tool is in the ‘panning’ state.

Stops panning if the left mouse button is the drag button.

panning_middle_up(event)

Handles the middle mouse button coming up when the tool is in the ‘panning’ state.

Stops panning if the middle mouse button is the drag button.

panning_mouse_leave(event)

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

Ends panning.

panning_mouse_move(event)

Handles the mouse being moved when the tool is in the ‘panning’ state.

panning_right_up(event)

Handles the right mouse button coming up when the tool is in the ‘panning’ state.

Stops panning if the right mouse button is the drag button.

restrict_to_data = Bool(False)

Restrict to the bounds of the plot data

speed = Float(1.0)

Scaling factor on the panning “speed”.

visible = False

The tool is not visible (overrides BaseTool).