MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / _rendercursor

Method _rendercursor

site-packages/matplotlib/widgets.py:736–761  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

734 transform=self.ax.transAxes)
735
736 def _rendercursor(self):
737 # this is a hack to figure out where the cursor should go.
738 # we draw the text up to where the cursor should go, measure
739 # and save its dimensions, draw the real text, then put the cursor
740 # at the saved dimensions
741
742 widthtext = self.text[:self.cursor_index]
743 no_text = False
744 if(widthtext == "" or widthtext == " " or widthtext == " "):
745 no_text = widthtext == ""
746 widthtext = ","
747
748 wt_disp = self._make_text_disp(widthtext)
749
750 self.ax.figure.canvas.draw()
751 bb = wt_disp.get_window_extent()
752 inv = self.ax.transData.inverted()
753 bb = inv.transform(bb)
754 wt_disp.set_visible(False)
755 if no_text:
756 bb[1, 0] = bb[0, 0]
757 # hack done
758 self.cursor.set_visible(False)
759
760 self.cursor = self.ax.vlines(bb[1, 0], bb[0, 1], bb[1, 1])
761 self.ax.figure.canvas.draw()
762
763 def _notify_submit_observers(self):
764 for cid, func in self.submit_observers.items():

Callers 3

_keypressMethod · 0.95
set_valMethod · 0.95
position_cursorMethod · 0.95

Calls 7

_make_text_dispMethod · 0.95
vlinesMethod · 0.80
drawMethod · 0.45
get_window_extentMethod · 0.45
invertedMethod · 0.45
transformMethod · 0.45
set_visibleMethod · 0.45

Tested by

no test coverage detected