The TextArea is contains a single Text instance. The text is placed at (0,0) with baseline+left alignment. The width and height of the TextArea instance is the width and height of the its child text.
| 684 | |
| 685 | |
| 686 | class TextArea(OffsetBox): |
| 687 | """ |
| 688 | The TextArea is contains a single Text instance. The text is |
| 689 | placed at (0,0) with baseline+left alignment. The width and height |
| 690 | of the TextArea instance is the width and height of the its child |
| 691 | text. |
| 692 | """ |
| 693 | def __init__(self, s, |
| 694 | textprops=None, |
| 695 | multilinebaseline=None, |
| 696 | minimumdescent=True, |
| 697 | ): |
| 698 | """ |
| 699 | Parameters |
| 700 | ---------- |
| 701 | s : str |
| 702 | a string to be displayed. |
| 703 | |
| 704 | textprops : `~matplotlib.font_manager.FontProperties`, optional |
| 705 | |
| 706 | multilinebaseline : bool, optional |
| 707 | If `True`, baseline for multiline text is adjusted so that |
| 708 | it is (approximatedly) center-aligned with singleline |
| 709 | text. |
| 710 | |
| 711 | minimumdescent : bool, optional |
| 712 | If `True`, the box has a minimum descent of "p". |
| 713 | """ |
| 714 | if textprops is None: |
| 715 | textprops = {} |
| 716 | |
| 717 | if "va" not in textprops: |
| 718 | textprops["va"] = "baseline" |
| 719 | |
| 720 | self._text = mtext.Text(0, 0, s, **textprops) |
| 721 | |
| 722 | OffsetBox.__init__(self) |
| 723 | |
| 724 | self._children = [self._text] |
| 725 | |
| 726 | self.offset_transform = mtransforms.Affine2D() |
| 727 | self.offset_transform.clear() |
| 728 | self.offset_transform.translate(0, 0) |
| 729 | self._baseline_transform = mtransforms.Affine2D() |
| 730 | self._text.set_transform(self.offset_transform + |
| 731 | self._baseline_transform) |
| 732 | |
| 733 | self._multilinebaseline = multilinebaseline |
| 734 | self._minimumdescent = minimumdescent |
| 735 | |
| 736 | def set_text(self, s): |
| 737 | "Set the text of this area as a string." |
| 738 | self._text.set_text(s) |
| 739 | self.stale = True |
| 740 | |
| 741 | def get_text(self): |
| 742 | "Returns the string representation of this area's text" |
| 743 | return self._text.get_text() |
no outgoing calls
no test coverage detected