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


Python TextNode.setText方法代码示例

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


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

示例1: renderClickableModel

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setText [as 别名]
    def renderClickableModel(self, showModel=True, showName=False):
        ''' Render just the clickable (reference) model '''
        # Hide all non clickable objects
        self.nonClickable.clearColor()
        self.nonClickable.hide()
        # Show the clickable model with the original texture and color
        self.clickableModel.clearColor()
        self.clickableModel.clearColorScale()
        if showModel:
            # Place it in front of the user, face-to-face (we try to randomly parametrize the position and orientation of the reference model but in a way that the user can clearly see it face-to-face)
            self.clickableModel.setPos(0,40,0)
            self.clickableModel = self.normalizeModelSize(self.clickableModel, self.minModelSize, self.maxModelSize, self.clickableModelSize) # set size (normalize size and set a random size in the normalized range)
            self.clickableModel.setHpr(random.uniform(-45, 45), random.uniform(-15, 15), 0)
            self.clickableModel.setColorScale(random.random(), random.random(), random.random(), 1.0)
        else:
            self.clickable.hide()

        if showName:
            if not hasattr(self, 'clickableText') or self.clickableText != self.clickableModelName:
                if hasattr(self, 'clickableText'):
                    self.clickableText.remove()
                text = TextNode('reference model name')
                text.setText(self.clickableModelName)
                text.setAlign(TextNode.ACenter)
                self.clickableText = render2d.attachNewNode(text)
                self.clickableText.setScale( 0.2 )
                self.clickableText.setPos( 0, 0, -0.8 )
开发者ID:lrq3000,项目名称:waCaptcha,代码行数:29,代码来源:worldgenerator.py

示例2: addAvatar

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setText [as 别名]
    def addAvatar(self, avId, name, damage):
        if self.currentIndex == 0:
            self.addLeaderboardLabel()

        self.avId2Names[avId] = name
        self.avId2Damage[avId] = damage

        text = TextNode('leaderboard-%d' % avId)
        text.setAlign(TextNode.ACenter)
        text.setFlattenFlags(TextNode.FFMedium)
        text.setFont(getSuitFont())
        text.setTextScale(0.05)
        text.setTextColor(*TEXT_WHITE)
        text.setText(name + ': ' + str(damage))
        textNodePath = aspect2d.attachNewNode(text)
        textNodePath.reparentTo(base.a2dTopRight)

        if self.currentIndex:
            self.index2Pos[self.currentIndex] = (-0.35, 0.0, (TEXT_HEIGHT * self.currentIndex) - 0.1)
            textNodePath.setPos(*self.index2Pos[self.currentIndex])
        else:
            self.index2Pos[0] = (-0.35, 0.0, -0.20)
            textNodePath.setPos(*self.index2Pos[0])

        self.currentIndex += 1

        self.avId2Nodes[avId] = [textNodePath, text]
开发者ID:NostalgicTTR,项目名称:Toontown-Infinite-2016-Leak,代码行数:29,代码来源:BossBattleLeaderboard.py

示例3: loadSign

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setText [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:nate97,项目名称:src,代码行数:29,代码来源:DistributedPartyActivity.py

示例4: loadGUI

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setText [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:nate97,项目名称:src,代码行数:34,代码来源:DistributedPartyTrampolineActivity.py

示例5: draw_mstr

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setText [as 别名]
    def draw_mstr(self, mstr, box, identifier="", parameters=None):
        self.aspect = True
        if box.mode == "pixels":
            parent2d = self.get_parent_pixel2d()
        elif box.mode == "standard":
            parent2d = self.get_parent_render2d()
        elif box.mode == "aspect":
            parent2d = self.get_parent_aspect2d()

        tnode = TextNode(identifier)
        tnode.setText(mstr.value)
        # TODO: use more parameters
        if hasattr(parameters, "cardcolor"):
            tnode.setCardColor(*parameters.cardcolor)
            tnode.setCardAsMargin(0, 0, 0, 0)
            tnode.setCardDecal(True)
        if hasattr(parameters, "aspect"):
            self.aspect = parameters.aspect

        node = NodePath(tnode)
        self._scale(tnode, node, box.x, box.y, box.sizex, box.sizey)
        node.setBin("fixed", self.get_next_sortid())
        node.setDepthTest(False)
        node.setDepthWrite(False)
        node.reparentTo(parent2d)
        return (mstr, node, tnode, box, parameters)
开发者ID:agoose77,项目名称:hivesystem,代码行数:28,代码来源:pandacanvas_mstr.py

示例6: setupCoins2

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setText [as 别名]
    def setupCoins2(self):
        # display coins = 0
        textN = TextNode('coin-score')
        textN.setText(str("Coins: " + str(self.coinsCollected2)))
        textN.setSlant(0.1)
        textNodePath = self.aspect2d.attachNewNode(textN)
        textNodePath.setPos(0, 0.95, 0.9)
        textNodePath.setScale(0.08)
        randNum = random.sample(range(0, 1500, 200), 6)

        # coins
        for i in range(6):
            randX = random.uniform(-3.0, 3.2)
            randY = float(randNum[i])
            shape = BulletSphereShape(0.3)
            coinNode = BulletGhostNode('Coin-' + str(i))
            coinNode.addShape(shape)
            np = self.render.attachNewNode(coinNode)
            np.setCollideMask(BitMask32.allOff())
            np.setPos(randX, randY, 2)

            # Adding sphere model
            sphereNp = loader.loadModel('models/smiley.egg')
            sphereNp_tex = loader.loadTexture("models/sky/coin_2_tex.jpg")
            sphereNp.setTexture(sphereNp_tex, 1)
            sphereNp.reparentTo(np)
            sphereNp.setScale(0.45)
            sphereNp.hprInterval(2.5, Vec3(360, 0, 0)).loop()

            self.world2.attachGhost(coinNode)
            self.coins2.append(coinNode)
            print "node name:" + str(coinNode.getName())
开发者ID:anto004,项目名称:game-programming,代码行数:34,代码来源:Ecco.py

示例7: attachHostNameToSign

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setText [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:nate97,项目名称:src,代码行数:33,代码来源:DistributedParty.py

示例8: EndScreenHUD

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setText [as 别名]
class EndScreenHUD(DirectObject):
	def __init__(self, gameScreenFSM, winnerPlayer):
		self.gameScreenFSM = gameScreenFSM
		self.endScreenFrame = None
		self.isoScale = 3.2
		self.scale = (self.isoScale,1,self.isoScale)
		self.winnerName = winnerPlayer
	def __del__(self):
		if (self.endScreenFrame != None):
			self.endScreenFrame.destroy()
	def initHUD(self):
		self.endScreenFrame = DirectFrame(HUD_models,
								image = '../HUD images/winnerScreen.png',
								frameColor=(0,0,0,0.0),
								frameSize=(-1, 1, -1, 1),
								scale = self.scale,
								)
		
		self.winner = TextNode('Winner Name')
		self.winner.setText(self.winnerName)
		self.winner.setTextColor(255, 255, 0, 1)
		self.winner.setAlign(TextNode.ALeft)
		textNodePath = aspect2d.attachNewNode(self.winner)
		textNodePath.setScale(0.1)
		textNodePath.setPos(-0.1,0,0)

		#button = DirectButton(HUD_models, image='../HUD images/creditsButton.png', image_scale = (3.75,1,1) , pos = [-0.0/self.isoScale,0,-0.80/self.isoScale], scale = 0.06/self.isoScale , command= self.changeScene)


	def changeScene(self):
		clickButtonSound.play()
		self.gameScreenFSM.request("CreditScreen")
	
	def update(self):
		return
开发者ID:NiltonDuarte,项目名称:WoT,代码行数:37,代码来源:HUD.py

示例9: drawBuilding

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setText [as 别名]
    def drawBuilding(self, building, field):
        model = self.loader.loadModel('models/house')
        # model.setScale(0.05)
        model.reparentTo(field.model)
        building.model = model
        self.modelToBuilding[model.getKey()] = building
        player = self.game.currentPlayer()
        model.setTag('clickable', 'true')
        cs = CollisionSphere(0, 0, 0, 2)
        cnodePath = model.attachNewNode(CollisionNode('cnode'))
        cnodePath.node().addSolid(cs)
        # cnodePath.show()

        col = 256 * int(player.color)
        # set building title
        title = TextNode(str(building.model.getKey()) + '_title')
        title.setText(building.building)
        title.setCardColor(col, col, col, 1)
        title.setCardAsMargin(0.1, 0.1, 0.1, 0.1)
        title.setCardDecal(True)
        titleNode = self.render.attachNewNode(title)
        titleNode.reparentTo(building.model)
        titleNode.setScale(1.5)
        titleNode.setPos(0, 0, 3)
        titleNode.setBillboardPointEye()
开发者ID:mzdravkov,项目名称:comori,代码行数:27,代码来源:game_app.py

示例10: getSpaceGap

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setText [as 别名]
def getSpaceGap(gap, font=None):
	txtn = TextNode('tt')
	if font: txtn.setFont(font)
	s = ''
	txtn.setText(s)
	while txtn.getWidth() < gap:
			s += ' '
			txtn.setText(s)
	return s
开发者ID:rll,项目名称:labeling_tool,代码行数:11,代码来源:buttonjoe.py

示例11: drawFigures

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setText [as 别名]
    def drawFigures(self):
        for player in self.game.players:
            for figure in player.figures:
                if hasattr(figure, 'model'):
                    continue
                if type(figure) == Ship:
                    field = figure.field
                    figure.model = self.loader.loadModel('models/ship')
                    figure.model.reparentTo(field.model)
                    cs = CollisionSphere(1.5, 0, 1, 1.3)
                    cnodePath = figure.model.attachNewNode(
                        CollisionNode('cnode'))
                    cnodePath.node().addSolid(cs)
                    # cnodePath.show()
                    cs = CollisionSphere(0, 0, 1.4, 1.3)
                    cnodePath = figure.model.attachNewNode(
                        CollisionNode('cnode'))
                    cnodePath.node().addSolid(cs)
                    # cnodePath.show()
                    cs = CollisionSphere(-1.8, 0, 1, 1)
                    cnodePath = figure.model.attachNewNode(
                        CollisionNode('cnode'))
                    cnodePath.node().addSolid(cs)
                    # cnodePath.show()
                    figure.model.setScale(1.4)
                    figure.model.setHpr(90, 0, 0)
                    # figure.model.setTag('highlightable', 'true')
                    figure.model.setTag('clickable', 'true')
                    self.modelToFigure[figure.model.getKey()] = figure
                else:
                    field = figure.field
                    figure.model = self.loader.loadModel('models/warrior100')
                    figure.model.reparentTo(field.model)
                    cs = CollisionSphere(0, -.35, 7, 1)
                    cnodePath = figure.model.attachNewNode(
                        CollisionNode('cnode'))
                    cnodePath.node().addSolid(cs)
                    figure.model.setScale(0.35)
                    figure.model.setTag('highlightable', 'true')
                    figure.model.setTag('clickable', 'true')
                    self.modelToFigure[figure.model.getKey()] = figure

                col = 256 * int(player.color)
                # set figure title
                title = TextNode(str(figure.model.getKey()) + '_title')
                title.setText(type(figure).__name__)
                title.setCardColor(col, col, col, 1)
                title.setCardAsMargin(0.1, 0.1, 0.1, 0.1)
                title.setCardDecal(True)
                titleNode = self.render.attachNewNode(title)
                titleNode.reparentTo(figure.model)
                titleNode.setScale(3)
                titleNode.setPos(0, 3, 10)
                if type(figure) == Ship:
                    titleNode.setScale(1.5)
                    titleNode.setPos(-1.5, 0, 3)
                titleNode.setBillboardPointEye()
开发者ID:mzdravkov,项目名称:comori,代码行数:59,代码来源:game_app.py

示例12: _show

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setText [as 别名]
 def _show(self, ctb, identifier, parentnode):
     if self.node is not None: self.node.removeNode()
     tnode = TextNode(identifier)
     tnode.setText(ctb.text)
     r, g, b, a = ctb.textcolor.r / 255.0, ctb.textcolor.g / 255.0, ctb.textcolor.b / 255.0, ctb.textcolor.a / 255.0
     tnode.setTextColor(r, g, b, a)
     node = NodePath(tnode)
     self._scale(tnode, node)
     node.reparentTo(parentnode)
     self.node = node
开发者ID:agoose77,项目名称:hivesystem,代码行数:12,代码来源:coloredtext_panda.py

示例13: addText

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setText [as 别名]
	def addText(self,name,text,xpos,ypos,r,g,b,align):
		textNode=TextNode(name)
		textNode.setText(text)
		textNode.setFont(self.font)
		textNode.setTextColor(r,g,b,1.0)
		textNode.setAlign(align)
		textNodePath=self.containerNode.attachNewNode(textNode)
		textNodePath.setScale(self.fontScale)
		textNodePath.setPos((2.0/self.characterWidth*xpos)-1,0.0,(2.0/self.characterHeight*ypos)-1) 
		return textNode
开发者ID:jonathanopalise,项目名称:grid-leader,代码行数:12,代码来源:textoverlay.py

示例14: draw

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setText [as 别名]
 def draw(self):
     # stuffandeer stuffandeer otus
     for card in self.hand:
         textn = TextNode(card.name)
         textn.setText(card.name)
         textnp = card.model.attachNewNode(textn)
         textnp.setScale(0.3)
         textnp.setPos(card.model, -2, 0, 1)
         textnp.setHpr(card.model, 0, -90, -90)
         textn.setAlign(TextNode.ACenter)
开发者ID:Allexit,项目名称:tgc-game,代码行数:12,代码来源:hand.py

示例15: displayText

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setText [as 别名]
	def displayText(self,text):
		newTextNode = TextNode('text')
		newTextNode.setText(text)
		newTextNode.setAlign(TextNode.ACenter)
		newTextNode.setWordwrap(16.0)
		text_generate = newTextNode.generate()
		newTextNodePath = render.attachNewNode(text_generate)
		newTextNodePath.setPos(0,1000,190)
		newTextNodePath.setScale(30,30,30)
		self.textEffects(newTextNodePath)
		return newTextNodePath
开发者ID:alebruck,项目名称:Dance2Rehab3D,代码行数:13,代码来源:main.py


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