From 35cacc78aaf4100a8da3fdd9020d7e563fdeab71 Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Tue, 30 Sep 2014 16:23:00 -0400 Subject: [PATCH] Update docstrings for TextItem --- pyqtgraph/graphicsItems/TextItem.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/pyqtgraph/graphicsItems/TextItem.py b/pyqtgraph/graphicsItems/TextItem.py index 22b1eee6..d3c98006 100644 --- a/pyqtgraph/graphicsItems/TextItem.py +++ b/pyqtgraph/graphicsItems/TextItem.py @@ -44,6 +44,11 @@ class TextItem(UIGraphicsItem): self.setFlag(self.ItemIgnoresTransformations) ## This is required to keep the text unscaled inside the viewport def setText(self, text, color=(200,200,200)): + """ + Set the text and color of this item. + + This method sets the plain text of the item; see also setHtml(). + """ color = fn.mkColor(color) self.textItem.setDefaultTextColor(color) self.textItem.setPlainText(text) @@ -57,18 +62,41 @@ class TextItem(UIGraphicsItem): #self.translate(0, 20) def setPlainText(self, *args): + """ + Set the plain text to be rendered by this item. + + See QtGui.QGraphicsTextItem.setPlainText(). + """ self.textItem.setPlainText(*args) self.updateText() def setHtml(self, *args): + """ + Set the HTML code to be rendered by this item. + + See QtGui.QGraphicsTextItem.setHtml(). + """ self.textItem.setHtml(*args) self.updateText() def setTextWidth(self, *args): + """ + Set the width of the text. + + If the text requires more space than the width limit, then it will be + wrapped into multiple lines. + + See QtGui.QGraphicsTextItem.setTextWidth(). + """ self.textItem.setTextWidth(*args) self.updateText() def setFont(self, *args): + """ + Set the font for this text. + + See QtGui.QGraphicsTextItem.setFont(). + """ self.textItem.setFont(*args) self.updateText()