From e06875f5379b227db6b4243349499fa6e0ff426d Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Thu, 23 Oct 2003 03:15:32 +0000 Subject: [PATCH] added clearText() and appendText() --- direct/src/gui/OnscreenText.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/direct/src/gui/OnscreenText.py b/direct/src/gui/OnscreenText.py index 66f519ec6d..391badd5a7 100644 --- a/direct/src/gui/OnscreenText.py +++ b/direct/src/gui/OnscreenText.py @@ -32,8 +32,7 @@ class OnscreenText(PandaObject, NodePath): parent = None, sort = 0, mayChange = 0): - """__init__(self, ...) - + """ Make a text node from string, put it into the 2d sg and set it up with all the indicated parameters. @@ -88,7 +87,6 @@ class OnscreenText(PandaObject, NodePath): mayChange: pass true if the text or its properties may need to be changed at runtime, false if it is static once created (which leads to better memory optimization). - """ if parent == None: parent = aspect2d @@ -110,7 +108,6 @@ class OnscreenText(PandaObject, NodePath): frame = frame or (0, 0, 0, 0) if align == None: align = TextNode.ACenter - elif style == ScreenTitle: scale = scale or 0.15 fg = fg or (1, 0.2, 0.2, 1) @@ -119,7 +116,6 @@ class OnscreenText(PandaObject, NodePath): frame = frame or (0, 0, 0, 0) if align == None: align = TextNode.ACenter - elif style == ScreenPrompt: scale = scale or 0.1 fg = fg or (1, 1, 0, 1) @@ -128,7 +124,6 @@ class OnscreenText(PandaObject, NodePath): frame = frame or (0, 0, 0, 0) if align == None: align = TextNode.ACenter - elif style == NameConfirm: scale = scale or 0.1 fg = fg or (0, 1, 0, 1) @@ -137,7 +132,6 @@ class OnscreenText(PandaObject, NodePath): frame = frame or (0, 0, 0, 0) if align == None: align = TextNode.ACenter - elif style == BlackOnWhite: scale = scale or 0.1 fg = fg or (0, 0, 0, 1) @@ -146,7 +140,6 @@ class OnscreenText(PandaObject, NodePath): frame = frame or (0, 0, 0, 0) if align == None: align = TextNode.ACenter - else: raise ValueError @@ -223,8 +216,6 @@ class OnscreenText(PandaObject, NodePath): self.assign(parent.attachNewNode(self.textNode, sort)) def cleanup(self): - """cleanup(self) - """ self.textNode = None if self.isClean == 0: self.isClean = 1 @@ -256,9 +247,15 @@ class OnscreenText(PandaObject, NodePath): def getFont(self): return self.textNode.getFont() + def clearText(self): + self.textNode.clearText() + def setText(self, text): self.textNode.setText(text) + def appendText(self, text): + self.textNode.appendText(text) + def getText(self): return self.textNode.getText()