Set text up so it is drawn in the right place.
(self, renderer)
| 150 | self.stale = False |
| 151 | |
| 152 | def _set_text_position(self, renderer): |
| 153 | """Set text up so it is drawn in the right place.""" |
| 154 | bbox = self.get_window_extent(renderer) |
| 155 | # center vertically |
| 156 | y = bbox.y0 + bbox.height / 2 |
| 157 | # position horizontally |
| 158 | loc = self._text.get_horizontalalignment() |
| 159 | if loc == 'center': |
| 160 | x = bbox.x0 + bbox.width / 2 |
| 161 | elif loc == 'left': |
| 162 | x = bbox.x0 + bbox.width * self.PAD |
| 163 | else: # right. |
| 164 | x = bbox.x0 + bbox.width * (1 - self.PAD) |
| 165 | self._text.set_position((x, y)) |
| 166 | |
| 167 | def get_text_bounds(self, renderer): |
| 168 | """ |
no test coverage detected