Skip to content
Browse files
ENH: added bounding box property to extract the w,h of rendered text
NB: Currently only works in pixels
  • Loading branch information
peircej committed Jun 25, 2015
1 parent 02571d0 commit 35c168f1db3f35791ec21f94b4d63fbbb2603ed1
Showing with 12 additions and 1 deletion.
  1. +12 −1 psychopy/visual/
@@ -522,7 +522,18 @@ def wrapWidth(self, wrapWidth):
self.__dict__['wrapWidth'] = wrapWidth
self._wrapWidthPix = convertToPix(pos = numpy.array([0, 0]), vertices=numpy.array([self.wrapWidth, 0]), units=self.units,[0]
self._needSetText = True

def boundingBox(self):
"""(read only) attribute representing the bounding box of the text (w,h).
This differs from `width` in that the width represents the width of the
margins, which might differ from the width of the text within them
NOTE: currently always returns the size in pixels
(this will change to return in stimulus units)
return (self._pygletTextObj._layout.content_width, self._pygletTextObj._layout.content_height)

def posPix(self):
"""This determines the coordinates in pixels of the position for the

0 comments on commit 35c168f

Please sign in to comment.