10000 Added a TextBox widget by keflavich · Pull Request #1983 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Added a TextBox widget #1983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 26 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs
  • Loading branch information
Matt Terry committed Jun 4, 2013
commit dc8ef76045af8fcfec736345976c881b491a8595
33 changes: 18 additions & 15 deletions lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1671,26 +1671,29 @@ def __init__(self, ax, s='', enter_callback=None, **text_kwargs):
Creates a mouse-click callback such that clicking on the text box will
activate the cursor.

*WARNING* Activating a textbox will permanently disable all other
key-press bindings! They'll be stored in TextBox.old_callbacks and
restored when TextBox.deactivate is called.
*WARNING* Activating a textbox will remove all other key-press
bindings! They'll be stored in FloatTextBox.old_callbacks and restored
when FloatTextBox.end_text_entry() is called.

The default widget assumes only numerical (float) data and will not
The default widget assumes only numerical data and will not
allow text entry besides numerical characters and ('e','-','.')

Parameters
----------
ax : axis
Parent axis to turn into text box
s : str
Initial string contents of text box
horizontalalignment : left | center | right
Passed to self.text
enter_callback : function
A function of one argument that will be called with TextBox.value
passed in as the only argument when enter is pressed
fontsize : int
Font size for text box
*ax* : :class:`matplotlib.axes.Axes`
The parent axes for the widget

*s* : str
The initial text of the FloatTextBox. Should be able to be coerced
to a float.

*enter_callback* : function
A function of one argument that will be called with
FloatTextBox.value passed in as the only argument when enter is
pressed

*text_kwargs* :
Additional keywork arguments are passed on to self.ax.text()
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I'm not familiar with the numpydoc format but we should conform to that for the sake of consistency.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in my branch.

AxesWidget.__init__(self, ax)
self.ax.set_navigate(False)
Expand Down
0