enable.tools.button_tool module¶
ButtonTool¶
A simple tool that responds to mouse clicks.
-
class
enable.tools.button_tool.
ButtonTool
(component=None, **traits)[source]¶ Bases:
enable.base_tool.BaseTool
A button tool
This tool allows any component to act like either a push button or a toggle button (such as a checkbox) with appropriate traits listeners.
Components which use this class can listen to the
clicked
event or listen to thechecked
state, depending on whether they want “push button” or “check box” style behaviour.Components may also want to listen to the
down
attribute to change the way that they are drawn in response to the mouse position, for example by highlighting the component.-
checked
= Bool(False)¶ Is the button toggled?
-
click
()[source]¶ Perform a click, toggling if needed, and firing the clicked event
This doesn’t change the state of the
down
trait.
-
clicked
= Event¶ Event fired when button is clicked
-
down
= Bool(False)¶ Is the mouse button pressed down in the clickable region
-
enabled
= Bool(True)¶ whether or not the button can be pressed.
-
is_clickable
(x, y)[source]¶ Is the (x,y) position in a region that responds to clicks.
Used by the tool to determine when to start a click and when the button should be considered pressed down (this controls the state of the
down
trait).
-
togglable
= Bool(False)¶ whether or not the button can be toggled (eg. checkbox or radio button).
-
Table of Contents
Previous topic
enable.tools.base_zoom_tool module