MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / TextBox

Class TextBox

lib/matplotlib/widgets.py:1492–1754  ·  view source on GitHub ↗

A GUI neutral text input box. For the text box to remain responsive you must keep a reference to it. Call `.on_text_change` to be updated whenever the text changes. Call `.on_submit` to be updated whenever the user hits enter or leaves the text entry field. Attributes

Source from the content-addressed store, hash-verified

1490
1491
1492class TextBox(AxesWidget):
1493 """
1494 A GUI neutral text input box.
1495
1496 For the text box to remain responsive you must keep a reference to it.
1497
1498 Call `.on_text_change` to be updated whenever the text changes.
1499
1500 Call `.on_submit` to be updated whenever the user hits enter or
1501 leaves the text entry field.
1502
1503 Attributes
1504 ----------
1505 ax : `~matplotlib.axes.Axes`
1506 The parent Axes for the widget.
1507 label : `~matplotlib.text.Text`
1508
1509 color : :mpltype:`color`
1510 The color of the text box when not hovering.
1511 hovercolor : :mpltype:`color`
1512 The color of the text box when hovering.
1513 """
1514
1515 def __init__(self, ax, label, initial='', *,
1516 color='.95', hovercolor='1', label_pad=.01,
1517 textalignment="left"):
1518 """
1519 Parameters
1520 ----------
1521 ax : `~matplotlib.axes.Axes`
1522 The `~.axes.Axes` instance the button will be placed into.
1523 label : str
1524 Label for this text box.
1525 initial : str
1526 Initial value in the text box.
1527 color : :mpltype:`color`
1528 The color of the box.
1529 hovercolor : :mpltype:`color`
1530 The color of the box when the mouse is over it.
1531 label_pad : float
1532 The distance between the label and the right side of the textbox.
1533 textalignment : {'left', 'center', 'right'}
1534 The horizontal location of the text.
1535 """
1536 super().__init__(ax)
1537
1538 self._text_position = _api.getitem_checked(
1539 {"left": 0.05, "center": 0.5, "right": 0.95},
1540 textalignment=textalignment)
1541
1542 self.label = ax.text(
1543 -label_pad, 0.5, label, transform=ax.transAxes,
1544 verticalalignment='center', horizontalalignment='right')
1545
1546 # TextBox's text object should not parse mathtext at all.
1547 self.text_disp = self.ax.text(
1548 self._text_position, 0.5, initial, transform=self.ax.transAxes,
1549 verticalalignment='center', horizontalalignment=textalignment,

Callers 1

textbox.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…