Parameters ---------- ax : matplotlib.axes.Axes The :class:`matplotlib.axes.Axes` instance the button will be placed into. label : str Label for this text box. Accepts string. initial : str Initial value in th
(self, ax, label, initial='',
color='.95', hovercolor='1', label_pad=.01)
| 659 | """ |
| 660 | |
| 661 | def __init__(self, ax, label, initial='', |
| 662 | color='.95', hovercolor='1', label_pad=.01): |
| 663 | """ |
| 664 | Parameters |
| 665 | ---------- |
| 666 | ax : matplotlib.axes.Axes |
| 667 | The :class:`matplotlib.axes.Axes` instance the button |
| 668 | will be placed into. |
| 669 | |
| 670 | label : str |
| 671 | Label for this text box. Accepts string. |
| 672 | |
| 673 | initial : str |
| 674 | Initial value in the text box |
| 675 | |
| 676 | color : color |
| 677 | The color of the box |
| 678 | |
| 679 | hovercolor : color |
| 680 | The color of the box when the mouse is over it |
| 681 | |
| 682 | label_pad : float |
| 683 | the distance between the label and the right side of the textbox |
| 684 | """ |
| 685 | AxesWidget.__init__(self, ax) |
| 686 | |
| 687 | self.DIST_FROM_LEFT = .05 |
| 688 | |
| 689 | self.params_to_disable = [key for key in rcParams if 'keymap' in key] |
| 690 | |
| 691 | self.text = initial |
| 692 | self.label = ax.text(-label_pad, 0.5, label, |
| 693 | verticalalignment='center', |
| 694 | horizontalalignment='right', |
| 695 | transform=ax.transAxes) |
| 696 | self.text_disp = self._make_text_disp(self.text) |
| 697 | |
| 698 | self.cnt = 0 |
| 699 | self.change_observers = {} |
| 700 | self.submit_observers = {} |
| 701 | |
| 702 | # If these lines are removed, the cursor won't appear the first |
| 703 | # time the box is clicked: |
| 704 | self.ax.set_xlim(0, 1) |
| 705 | self.ax.set_ylim(0, 1) |
| 706 | |
| 707 | self.cursor_index = 0 |
| 708 | |
| 709 | # Because this is initialized, _render_cursor |
| 710 | # can assume that cursor exists. |
| 711 | self.cursor = self.ax.vlines(0, 0, 0) |
| 712 | self.cursor.set_visible(False) |
| 713 | |
| 714 | self.connect_event('button_press_event', self._click) |
| 715 | self.connect_event('button_release_event', self._release) |
| 716 | self.connect_event('motion_notify_event', self._motion) |
| 717 | self.connect_event('key_press_event', self._keypress) |
| 718 | self.connect_event('resize_event', self._resize) |
nothing calls this directly
no test coverage detected