Panda3D
Public Member Functions | Public Attributes | List of all members
OnscreenText Class Reference
Inheritance diagram for OnscreenText:
DirectObject

Public Member Functions

def __init__ (self, text='', style=Plain, pos=(0, 0), roll=0, scale=None, fg=None, bg=None, shadow=None, shadowOffset=(0.04, 0.04), frame=None, align=None, wordwrap=None, drawOrder=None, decal=0, font=None, parent=None, sort=0, mayChange=True)
 
def __setitem__ (self, key, value)
 
def appendText (self, text)
 
def cget (self, option)
 
def cleanup (self)
 
def clearText (self)
 
def configure (self, option=None, kw)
 
def destroy (self)
 
def freeze (self)
 
def getDecal (self)
 
def getFont (self)
 
def getPos (self)
 
def getRoll (self)
 
def getScale (self)
 
def getText (self)
 
def getWordwrap (self)
 
def setAlign (self, align)
 
def setBg (self, bg)
 
def setDecal (self, decal)
 
def setFg (self, fg)
 
def setFont (self, font)
 
def setFrame (self, frame)
 
def setPos (self, x, y)
 
def setRoll (self, roll)
 
def setScale (self, sx, sy=None)
 
def setShadow (self, shadow)
 
def setText (self, text)
 
def setWordwrap (self, wordwrap)
 
def setX (self, x)
 
def setY (self, y)
 
def thaw (self)
 
def updateTransformMat (self)
 
- Public Member Functions inherited from DirectObject
def __init__ (self)
 
def accept (self, event, method, extraArgs=[])
 
def acceptOnce (self, event, method, extraArgs=[])
 
def addTask (self, args, kwargs)
 
def detectLeaks (self)
 
def doMethodLater (self, args, kwargs)
 
def getAllAccepting (self)
 
def ignore (self, event)
 
def ignoreAll (self)
 
def isAccepting (self, event)
 
def isIgnoring (self, event)
 
def removeAllTasks (self)
 
def removeTask (self, taskOrName)
 

Public Attributes

 isClean
 
 mayChange
 
 pos
 
 roll
 
 scale
 
 textNode
 
 unicodeText
 
 wordwrap
 

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  text = '',
  style = Plain,
  pos = (0, 0),
  roll = 0,
  scale = None,
  fg = None,
  bg = None,
  shadow = None,
  shadowOffset = (0.04, 0.04),
  frame = None,
  align = None,
  wordwrap = None,
  drawOrder = None,
  decal = 0,
  font = None,
  parent = None,
  sort = 0,
  mayChange = True 
)
Make a text node from string, put it into the 2d sg and set it
up with all the indicated parameters.

The parameters are as follows:

  text: the actual text to display.  This may be omitted and
      specified later via setText() if you don't have it
      available, but it is better to specify it up front.

  style: one of the pre-canned style parameters defined at the
      head of this file.  This sets up the default values for
      many of the remaining parameters if they are
      unspecified; however, a parameter may still be specified
      to explicitly set it, overriding the pre-canned style.

  pos: the x, y position of the text on the screen.

  scale: the size of the text.  This may either be a single
      float (and it will usually be a small number like 0.07)
      or it may be a 2-tuple of floats, specifying a different
      x, y scale.

  fg: the (r, g, b, a) foreground color of the text.  This is
      normally a 4-tuple of floats or ints.

  bg: the (r, g, b, a) background color of the text.  If the
      fourth value, a, is nonzero, a card is created to place
      behind the text and set to the given color.

  shadow: the (r, g, b, a) color of the shadow behind the text.
      If the fourth value, a, is nonzero, a little drop shadow
      is created and placed behind the text.

  frame: the (r, g, b, a) color of the frame drawn around the
      text.  If the fourth value, a, is nonzero, a frame is
      created around the text.

  align: one of TextNode.ALeft, TextNode.ARight, or TextNode.ACenter.

  wordwrap: either the width to wordwrap the text at, or None
      to specify no automatic word wrapping.

  drawOrder: the drawing order of this text with respect to
      all other things in the 'fixed' bin within render2d.
      The text will actually use drawOrder through drawOrder +
      2.

  decal: if this is True, the text is decalled onto its
      background card.  Useful when the text will be parented
      into the 3-D scene graph.

  font: the font to use for the text.

  parent: the NodePath to parent the text to initially.

  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).

Member Function Documentation

◆ __setitem__()

def __setitem__ (   self,
  key,
  value 
)

◆ appendText()

def appendText (   self,
  text 
)

◆ cget()

def cget (   self,
  option 
)

◆ cleanup()

def cleanup (   self)

◆ clearText()

def clearText (   self)

◆ configure()

def configure (   self,
  option = None,
  kw 
)

◆ destroy()

def destroy (   self)

◆ freeze()

def freeze (   self)

◆ getDecal()

def getDecal (   self)

◆ getFont()

def getFont (   self)

◆ getPos()

def getPos (   self)

◆ getRoll()

def getRoll (   self)

◆ getScale()

def getScale (   self)

◆ getText()

def getText (   self)

◆ getWordwrap()

def getWordwrap (   self)

◆ setAlign()

def setAlign (   self,
  align 
)

◆ setBg()

def setBg (   self,
  bg 
)

◆ setDecal()

def setDecal (   self,
  decal 
)

◆ setFg()

def setFg (   self,
  fg 
)

◆ setFont()

def setFont (   self,
  font 
)

◆ setFrame()

def setFrame (   self,
  frame 
)

◆ setPos()

def setPos (   self,
  x,
  y 
)
setPos(self, float, float)
Position the onscreen text in 2d screen space

◆ setRoll()

def setRoll (   self,
  roll 
)
setRoll(self, float)
Rotate the onscreen text around the screen's normal

◆ setScale()

def setScale (   self,
  sx,
  sy = None 
)
setScale(self, float, float)
Scale the text in 2d space.  You may specify either a single
uniform scale, or two scales, or a tuple of two scales.

◆ setShadow()

def setShadow (   self,
  shadow 
)

◆ setText()

def setText (   self,
  text 
)

◆ setWordwrap()

def setWordwrap (   self,
  wordwrap 
)

◆ setX()

def setX (   self,
  x 
)

◆ setY()

def setY (   self,
  y 
)

◆ thaw()

def thaw (   self)

◆ updateTransformMat()

def updateTransformMat (   self)

Member Data Documentation

◆ isClean

isClean

◆ mayChange

mayChange

◆ pos

pos

◆ roll

roll

◆ scale

scale

◆ textNode

textNode

◆ unicodeText

unicodeText

◆ wordwrap

wordwrap