def wrap(self, availWidth, availHeight): availHeight = self.setMaxHeight(availHeight) style = self.style self.deltaWidth = style.paddingLeft + style.paddingRight + style.borderLeftWidth + style.borderRightWidth self.deltaHeight = style.paddingTop + style.paddingBottom + style.borderTopWidth + style.borderBottomWidth # reduce the available width & height by the padding so the wrapping # will use the correct size availWidth -= self.deltaWidth availHeight -= self.deltaHeight # Modify maxium image sizes self._calcImageMaxSizes(availWidth, self.getMaxHeight() - self.deltaHeight) # call the base class to do wrapping and calculate the size Paragraph.wrap(self, availWidth, availHeight) #self.height = max(1, self.height) #self.width = max(1, self.width) # increase the calculated size by the padding self.width = self.width + self.deltaWidth self.height = self.height + self.deltaHeight return (self.width, self.height)