当前位置: 首页>>代码示例>>Python>>正文


Python TextNode.setTextColor方法代码示例

本文整理汇总了Python中pandac.PandaModules.TextNode.setTextColor方法的典型用法代码示例。如果您正苦于以下问题:Python TextNode.setTextColor方法的具体用法?Python TextNode.setTextColor怎么用?Python TextNode.setTextColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pandac.PandaModules.TextNode的用法示例。


在下文中一共展示了TextNode.setTextColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: AddMessage

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setTextColor [as 别名]
 def AddMessage(self, prefix, prefixColor, message):
     parent = self.displayFrame.attachNewNode('messageParent')
     
     prefixTextNode = TextNode('prefixMessage')
     prefixTextNode.setText(prefix)
     prefixTextNode.setTextColor(prefixColor)
     prefixTextNode.setShadow(0.05, 0.05)
     prefixTextNode.setShadowColor(Globals.COLOR_BLACK)
     prefixTextNodePath = parent.attachNewNode(prefixTextNode)
     prefixTextNodePath.setScale(Settings.CHAT_HEIGHT)
     
     messageTextNode = TextNode('prefixMessage')
     messageTextNode.setText(message)
     messageTextNode.setTextColor(1, 1, 1, 1)
     messageTextNode.setShadow(0.05, 0.05)
     messageTextNode.setShadowColor(Globals.COLOR_BLACK)
     messageTextNodePath = parent.attachNewNode(messageTextNode)
     messageTextNodePath.setScale(Settings.CHAT_HEIGHT)
     messageTextNodePath.setPos(Vec3(prefixTextNode.calcWidth(prefix) * Settings.CHAT_HEIGHT, 0, 0))
     
     taskMgr.remove('HideMessageLog')
     taskMgr.doMethodLater(ChatBox.MESSAGE_LIFE, self.HideMessageLog, 'HideMessageLog') 
     self.ShowMessageLog()
     
     self.textNodes.append(parent)
     
     if(len(self.textNodes) > ChatBox.MAX_NUM_MESSAGES):
         self.RemoveMessage(self.textNodes[0])
         
     self.RedrawMessages()
开发者ID:czorn,项目名称:Modifire,代码行数:32,代码来源:ChatBox.py

示例2: loadGUI

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setTextColor [as 别名]
 def loadGUI(self):
     self.gui = loader.loadModel('phase_13/models/parties/trampolineGUI')
     self.gui.reparentTo(base.a2dTopLeft)
     self.gui.setPos(0.115, 0, -1)
     self.gui.hide()
     self.toonIndicator = self.gui.find('**/trampolineGUI_MovingBar')
     jumpLineLocator = self.gui.find('**/jumpLine_locator')
     guiBean = self.gui.find('**/trampolineGUI_GreenJellyBean')
     self.gui.find('**/trampolineGUI_GreenJellyBean').stash()
     self.guiBeans = [ guiBean.instanceUnderNode(jumpLineLocator, self.uniqueName('guiBean%d' % i)) for i in xrange(self.numJellyBeans) ]
     self.guiBeans[-1].setScale(1.5)
     heightTextNode = TextNode(self.uniqueName('TrampolineActivity.heightTextNode'))
     heightTextNode.setFont(ToontownGlobals.getSignFont())
     heightTextNode.setAlign(TextNode.ALeft)
     heightTextNode.setText('0.0')
     heightTextNode.setShadow(0.05, 0.05)
     heightTextNode.setShadowColor(0.0, 0.0, 0.0, 1.0)
     heightTextNode.setTextColor(1.0, 1.0, 1.0, 1.0)
     self.heightText = jumpLineLocator.attachNewNode(heightTextNode)
     self.heightText.setX(0.15)
     self.heightText.setScale(0.1)
     self.heightText.setAlphaScale(0.0)
     self.quitEarlyButtonModels = loader.loadModel('phase_3.5/models/gui/inventory_gui')
     quitEarlyUp = self.quitEarlyButtonModels.find('**//InventoryButtonUp')
     quitEarlyDown = self.quitEarlyButtonModels.find('**/InventoryButtonDown')
     quitEarlyRollover = self.quitEarlyButtonModels.find('**/InventoryButtonRollover')
     self.quitEarlyButton = DirectButton(parent=base.a2dTopRight, relief=None, text=TTLocalizer.PartyTrampolineQuitEarlyButton, text_fg=(1, 1, 0.65, 1), text_pos=(0, -0.23), text_scale=0.7, image=(quitEarlyUp, quitEarlyDown, quitEarlyRollover), image_color=(1, 0, 0, 1), image_scale=(20, 1, 11), pos=(-0.183, 0, -0.4), scale=0.09, command=self.leaveTrampoline)
     self.quitEarlyButton.stash()
     self.flashText = OnscreenText(text='', pos=(0.0, -0.45), scale=0.2, fg=(1.0, 1.0, 0.65, 1.0), align=TextNode.ACenter, font=ToontownGlobals.getSignFont(), mayChange=True)
     self.timer = PartyUtils.getNewToontownTimer()
     self.timer.posInTopRightCorner()
     return
开发者ID:CalebSmith376,项目名称:src,代码行数:34,代码来源:DistributedPartyTrampolineActivity.py

示例3: _create_text_fields

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setTextColor [as 别名]
 def _create_text_fields(self, radius, width):
     test_letter = 'W'
     # the larger back side text field
     x,z = 0,0
     y = (width/2.0+Hexagon.text_distance)
     text = TextNode('')
     #font = loader.loadFont("cmss12.egg")
     #text.setFont(font)
     text.setGlyphScale(1.1*radius)
     text.setTextColor(0,0,0,1)
     self.back_side_text = self.root_node_path.attachNewNode(text)
     self.back_side_text.node().setText(test_letter)
     self.back_side_text.setH(180)
     center_node_on_xyz(self.back_side_text, x, y, z)
     self.back_side_text_z = self.back_side_text.getZ()
     # the six front side text fields
     self.front_side_text_coordinates = []
     for _i, phi in enumerate(range(0,360,60)):
         text = TextNode('')
         #text.setFont(font)
         text.setGlyphScale(0.45*radius)
         text.setTextColor(0,0,0,1)
         text_path = self.root_node_path.attachNewNode(text)
         self.front_side_text.append(text_path)
         x,z = rotate_phi_degrees_clockwise(phi, (0,radius/1.6))
         text_path.node().setText(test_letter)
         center_node_on_xyz(text_path, x, -y, z)
         self.front_side_text_coordinates.append((x,-y,z))
开发者ID:JingLu92,项目名称:pyff,代码行数:30,代码来源:Hexagon.py

示例4: __init__

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setTextColor [as 别名]
    def __init__(self,bat_np,t,x,y,col):
        rate = 2
        z = 20
        scale = 12
        scale_up = 15
        text_node = TextNode("battle_text")
        text_node.setText(t)
        text_node_path = bat_np.attachNewNode(text_node)
        text_node_path.reparentTo(render)
        text_node_path.setPos(x,y,0)
        text_node_path.setHpr(0,-90,0)
        text_node_path.setScale(scale)
        text_node_path.setTransparency(TransparencyAttrib.MAlpha)
        text_node.setTextColor(col)
        text_node.setAlign(TextNode.ACenter)
        node_scl_up = text_node_path.scaleInterval(rate, Point3(scale_up, scale_up, scale_up))
        node_z_up = text_node_path.posInterval(rate, Point3(x, y, z*2))
        node_z_up2 = text_node_path.posInterval(rate, Point3(x, y, z*2))
        node_fade_down = text_node_path.colorScaleInterval(rate, (col[0],col[1],col[2],0))
        node_func_death = Func(self.destroy)
        t_para = Parallel(node_scl_up,node_z_up,node_fade_down)
        t_seq = Sequence(t_para,node_func_death)

        t_seq.start()

        self.tnp = text_node_path
开发者ID:HepcatNZ,项目名称:EmpiresOfSuburbia,代码行数:28,代码来源:TimVisuals.py

示例5: loadSign

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setTextColor [as 别名]
 def loadSign(self):
     actNameForSign = self.activityName
     if self.activityId == PartyGlobals.ActivityIds.PartyJukebox40:
         actNameForSign = PartyGlobals.ActivityIds.getString(PartyGlobals.ActivityIds.PartyJukebox)
     elif self.activityId == PartyGlobals.ActivityIds.PartyDance20:
         actNameForSign = PartyGlobals.ActivityIds.getString(PartyGlobals.ActivityIds.PartyDance)
     self.sign = self.root.attachNewNode('%sSign' % self.activityName)
     self.signModel = self.party.defaultSignModel.copyTo(self.sign)
     self.signFlat = self.signModel.find('**/sign_flat')
     self.signFlatWithNote = self.signModel.find('**/sign_withNote')
     self.signTextLocator = self.signModel.find('**/signText_locator')
     textureNodePath = getPartyActivityIcon(self.party.activityIconsModel, actNameForSign)
     textureNodePath.setPos(0.0, -0.02, 2.2)
     textureNodePath.setScale(2.35)
     textureNodePath.copyTo(self.signFlat)
     textureNodePath.copyTo(self.signFlatWithNote)
     text = TextNode('noteText')
     text.setTextColor(0.2, 0.1, 0.7, 1.0)
     text.setAlign(TextNode.ACenter)
     text.setFont(OTPGlobals.getInterfaceFont())
     text.setWordwrap(10.0)
     text.setText('')
     self.noteText = self.signFlatWithNote.attachNewNode(text)
     self.noteText.setPosHpr(self.signTextLocator, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0)
     self.noteText.setScale(0.2)
     self.signFlatWithNote.stash()
     self.signTextLocator.stash()
开发者ID:ponyboy837,项目名称:SecretGitLolYoloSweg2015,代码行数:29,代码来源:DistributedPartyActivity.py

示例6: attachHostNameToSign

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setTextColor [as 别名]
 def attachHostNameToSign(self, locator):
     if self.hostName == "":
         return
     nameText = TextNode("nameText")
     nameText.setCardAsMargin(0.1, 0.1, 0.1, 0.1)
     nameText.setCardDecal(True)
     nameText.setCardColor(1.0, 1.0, 1.0, 0.0)
     r = 232.0 / 255.0
     g = 169.0 / 255.0
     b = 23.0 / 255.0
     nameText.setTextColor(r, g, b, 1)
     nameText.setAlign(nameText.ACenter)
     nameText.setFont(ToontownGlobals.getBuildingNametagFont())
     nameText.setShadowColor(0, 0, 0, 1)
     nameText.setBin("fixed")
     if TTLocalizer.BuildingNametagShadow:
         nameText.setShadow(*TTLocalizer.BuildingNametagShadow)
     nameWordWrap = 11.0
     nameText.setWordwrap(nameWordWrap)
     scaleMult = 0.48
     houseName = self.hostName
     nameText.setText(houseName)
     textWidth = nameText.getWidth()
     xScale = 1.0 * scaleMult
     if textWidth > nameWordWrap:
         xScale = nameWordWrap / textWidth * scaleMult
     sign_origin = locator
     namePlate = sign_origin.attachNewNode(nameText)
     namePlate.setDepthWrite(0)
     namePlate.setPos(0, 0, 0)
     namePlate.setScale(xScale)
开发者ID:XamarinDeveloper,项目名称:src,代码行数:33,代码来源:DistributedParty.py

示例7: place_markers

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setTextColor [as 别名]
    def place_markers(self,nodes):
        for n in range(len(nodes)):
            town_node = NodePath("town")
            town = loader.loadModel("models/infantry_counter.egg")
            x = (nodes[n+1]["x"]-map_center[0])*amplification
            y = (nodes[n+1]["y"]-map_center[1])*amplification
            town.setPos(x,y,0)
            if nodes[n+1]["type"] == "city":
                scale = 12
            elif nodes[n+1]["type"] == "town":
                scale = 7
            elif nodes[n+1]["type"] == "village":
                scale = 4
            town.setScale(scale,scale,scale)
            town.reparentTo(town_node)
            town_node.reparentTo(render)

            text_node = TextNode("town_text_node")
            text_node.setText(nodes[n+1]["name"])
            text_node_path = town.attachNewNode(text_node)
            text_node_path.setPos(1,0,0)
            text_node_path.setHpr(0,-90,0)
            text_node_path.setScale(scale/2)
            text_node_path.setTransparency(TransparencyAttrib.MAlpha)
            text_node.setTextColor(0.8, 0.1, 0.1, 1)
            text_node.setAlign(TextNode.ALeft)
开发者ID:HepcatNZ,项目名称:OSMGameMapper,代码行数:28,代码来源:osm_mapdata.py

示例8: printText

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setTextColor [as 别名]
def printText(name, message, color):
    text = TextNode(name)
    text.setText(message)
    x,y,z = color
    text.setTextColor(x,y,z, 1)
    text3d = NodePath(text)
    text3d.reparentTo(render)
    return text3d
开发者ID:xilinniao,项目名称:python-panda3d-examples,代码行数:10,代码来源:PandaCoords.py

示例9: printText

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setTextColor [as 别名]
    def printText(self, name, message, color, parent=render):
        text = TextNode(
            name
        )  # create a TextNode. Note that 'name' is not the text, rather it is a name that identifies the object.
        text.setText(message)  # Here we set the text of the TextNode
        x, y, z = color  # break apart the color tuple
        text.setTextColor(x, y, z, 1)  # Set the text color from the color tuple

        text3d = NodePath(text)  # Here we create a NodePath from the TextNode, so that we can manipulate it 'in world'
        text3d.reparentTo(parent)
        return text3d  # return the NodePath for further use
开发者ID:crempp,项目名称:Fire-Water,代码行数:13,代码来源:main.py

示例10: createText

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setTextColor [as 别名]
 def createText(self, number, position, color):
     text = TextNode('winText%d' % number)
     text.setAlign(TextNode.ACenter)
     text.setTextColor(color)
     text.setFont(ToontownGlobals.getSignFont())
     text.setText('')
     noteText = aspect2d.attachNewNode(text)
     noteText.setScale(0.2)
     noteText.setPos(position)
     noteText.stash()
     return (text, noteText)
开发者ID:MasterLoopyBM,项目名称:c0d3,代码行数:13,代码来源:PartyCogActivity.py

示例11: createDistanceLabel

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setTextColor [as 别名]
 def createDistanceLabel(self, number, color):
     text = TextNode('distanceText-%d' % number)
     text.setAlign(TextNode.ACenter)
     text.setTextColor(color)
     text.setFont(ToontownGlobals.getSignFont())
     text.setText('10 ft')
     node = self.root.attachNewNode(text)
     node.setBillboardPointEye()
     node.setScale(2.5)
     node.setZ(5.0)
     return (node, text)
开发者ID:MasterLoopyBM,项目名称:c0d3,代码行数:13,代码来源:PartyCogActivity.py

示例12: load

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setTextColor [as 别名]
 def load(self):
     from toontown.toonbase import ToontownGlobals
     from pandac.PandaModules import TextNode
     textNode = TextNode('moviedialogue')
     textNode.setTextColor(0, 0, 0, 1)
     textNode.setCardColor(1, 1, 1, 1)
     textNode.setCardAsMargin(0, 0, 0, 0)
     textNode.setCardDecal(True)
     textNode.setWordwrap(27.0)
     textNode.setAlign(TextNode.ACenter)
     textNode.setFont(ToontownGlobals.getToonFont())
     self._dialogueLabel = aspect2d.attachNewNode(textNode)
     self._dialogueLabel.setScale(0.06, 0.06, 0.06)
     self._dialogueLabel.setPos(0.32, 0, -0.75)
     self._dialogueLabel.reparentTo(hidden)
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:17,代码来源:CogdoUtil.py

示例13: load

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setTextColor [as 别名]
 def load(self, loadModels = 1, arenaModel = 'partyCatchTree'):
     self.notify.info('load()')
     DistributedPartyCatchActivity.notify.debug('PartyCatch: load')
     self.activityFSM = CatchActivityFSM(self)
     self.defineConstants()
     self.treesAndFence = loader.loadModel('phase_13/models/parties/%s' % arenaModel)
     self.treesAndFence.setScale(0.9)
     self.treesAndFence.find('**/fence_floor').setPos(0.0, 0.0, 0.1)
     self.treesAndFence.reparentTo(self.root)
     ground = self.treesAndFence.find('**/groundPlane')
     ground.setBin('ground', 1)
     DistributedPartyActivity.load(self)
     exitText = TextNode('PartyCatchExitText')
     exitText.setCardAsMargin(0.1, 0.1, 0.1, 0.1)
     exitText.setCardDecal(True)
     exitText.setCardColor(1.0, 1.0, 1.0, 0.0)
     exitText.setText(TTLocalizer.PartyCatchActivityExit)
     exitText.setTextColor(0.0, 8.0, 0.0, 0.9)
     exitText.setAlign(exitText.ACenter)
     exitText.setFont(ToontownGlobals.getBuildingNametagFont())
     exitText.setShadowColor(0, 0, 0, 1)
     exitText.setBin('fixed')
     if TTLocalizer.BuildingNametagShadow:
         exitText.setShadow(*TTLocalizer.BuildingNametagShadow)
     exitTextLoc = self.treesAndFence.find('**/loc_exitSignText')
     exitTextNp = exitTextLoc.attachNewNode(exitText)
     exitTextNp.setDepthWrite(0)
     exitTextNp.setScale(4)
     exitTextNp.setZ(-.5)
     self.sign.reparentTo(self.treesAndFence.find('**/loc_eventSign'))
     self.sign.wrtReparentTo(self.root)
     self.avatarNodePath = NodePath('PartyCatchAvatarNodePath')
     self.avatarNodePath.reparentTo(self.root)
     self._avatarNodePathParentToken = 3
     base.cr.parentMgr.registerParent(self._avatarNodePathParentToken, self.avatarNodePath)
     self.toonSDs = {}
     self.dropShadow = loader.loadModelOnce('phase_3/models/props/drop_shadow')
     self.dropObjModels = {}
     if loadModels:
         self.__loadDropModels()
     self.sndGoodCatch = base.loadSfx('phase_4/audio/sfx/SZ_DD_treasure.ogg')
     self.sndOof = base.loadSfx('phase_4/audio/sfx/MG_cannon_hit_dirt.ogg')
     self.sndAnvilLand = base.loadSfx('phase_4/audio/sfx/AA_drop_anvil_miss.ogg')
     self.sndPerfect = base.loadSfx('phase_4/audio/sfx/ring_perfect.ogg')
     self.__textGen = TextNode('partyCatchActivity')
     self.__textGen.setFont(ToontownGlobals.getSignFont())
     self.__textGen.setAlign(TextNode.ACenter)
     self.activityFSM.request('Idle')
开发者ID:BmanGames,项目名称:ToontownStride,代码行数:50,代码来源:DistributedPartyCatchActivity.py

示例14: __init__

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setTextColor [as 别名]
 def __init__(self, name, parent, pos = (0.0, 0.0, -0.5), scale = 0.09, color = (1.0, 1.0, 0, 1), sfx = None):
     self.color = color
     self._displaySfx = sfx
     textNode = TextNode('messageLabel.' + name)
     textNode.setTextColor(self.color)
     textNode.setAlign(TextNode.ACenter)
     textNode.setFont(ToontownGlobals.getSignFont())
     textNode.setShadow(0.06, 0.06)
     textNode.setShadowColor(0.5, 0.5, 0.5, 1.0)
     self.pos = pos
     self.scale = scale
     self.messageLabel = parent.attachNewNode(textNode)
     self.messageLabel.setPos(self.pos)
     self.messageLabel.setScale(self.scale)
     self.messageLabel.stash()
     self.transitionInterval = Sequence(name='%s.transitionInterval' % self.__class__.__name__)
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:18,代码来源:CogdoGameMessageDisplay.py

示例15: createText

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setTextColor [as 别名]
    def createText(self, text, pos=(0.0, 0.0), align=TextNode.ACenter, scale=None, colour=None):
        if colour is None:
            colour = self.colour
        if scale is None:
            scale = self.default_element_scale

        text_node = TextNode("text")
        text_node.setText(text)
        text_node.setGlyphScale(scale)
        text_node.setAlign(align)
        text_node.setFont(self.unicodefont)
        text_node.setTextColor(colour[0], colour[1], colour[2], colour[3])

        generated_text = text_node.generate()
        text_node_path = render2d.attachNewNode(generated_text)
        text_node_path.setPos(pos[0], 0.0, pos[1])
        return text_node, text_node_path
开发者ID:garym,项目名称:Azure--Infinite-Skies,代码行数:19,代码来源:gui.py


注:本文中的pandac.PandaModules.TextNode.setTextColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。