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


Python PandaModules.TextNode类代码示例

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


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

示例1: _create_text_fields

 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,代码行数:28,代码来源:Hexagon.py

示例2: __init__

    def __init__(self,juego):

        self.juego=juego

        self.puntuacion1 = TextNode('puntuacion1')
        self.puntuacion1.setText(str(self.juego.puntos1))
        nodo1 = self.juego.aspect2d.attachNewNode(self.puntuacion1)
        nodo1.setScale(0.1)
        nodo1.setPos(-0.5,0, 0.7)
        #nodo1.setPos(-0.5,-0.5)

        self.puntuacion2= TextNode('puntuacion1')
        self.puntuacion2.setText(str(self.juego.puntos2))
        nodo2 = self.juego.aspect2d.attachNewNode(self.puntuacion2)
        nodo2.setScale(0.1)
        nodo2.setPos(0.5,0,0.7)


        self.victoria= TextNode('victoria')
        self.victoria.setText("")
        #self.victoria.setWordwrap(7.0)
        nodo3 = self.juego.aspect2d.attachNewNode(self.victoria)
        nodo3.setScale(0.2)
        nodo3.setPos(-1.1,0,0)

        self.jugando=True
开发者ID:MandragoraStudio,项目名称:Pong,代码行数:26,代码来源:marcador.py

示例3: __init__

	def __init__(self):
		ShowBase.__init__(self)
		
		self.decisions = []
		self.isReady = False
		self.red = 0
		self.messageNode = TextNode("Message")
		self.choiceOneNode = TextNode("ChoiceOne")
		self.choiceTwoNode = TextNode("ChoiceTwo")
		self.instructionsNode = TextNode("Instructions")
		
		self.messageNode.setText('"Antigone, stop screaming!"')
		self.choiceOneNode.setText("[stop]")
		self.choiceTwoNode.setText("[scream louder]")
		self.instructionsNode.setText("Use the arrow keys to make a choice.")
		
		base.setBackgroundColor(self.red, 0, 0)
		base.disableMouse()
		props = WindowProperties()
		props.setTitle("Antigo Me")
		base.win.requestProperties(props)
		
		self.textDisplay()
		self.showText()
		
		self.isReady = True
		
		self.accept("arrow_left", self.decision, [0])
		self.accept("arrow_right", self.decision, [1])
开发者ID:her001,项目名称:AntigoMe,代码行数:29,代码来源:antigome.py

示例4: fontHasCharacters

 def fontHasCharacters(name, font = font):
     if font:
         tn = TextNode('NameCheck')
         tn.setFont(font)
         for c in name:
             if not tn.hasCharacter(ord(c)):
                 notify.info('name contains bad char: %s' % TextEncoder().encodeWtext(c))
                 return OTPLocalizer.NCBadCharacter % TextEncoder().encodeWtext(c)
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:8,代码来源:NameCheck.py

示例5: printText

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,代码行数:8,代码来源:PandaCoords.py

示例6: printText

    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,代码行数:11,代码来源:main.py

示例7: addball

 def addball(self, NUM):
     # pos = Vec3(random.uniform(-7, 7), random.uniform(-7, 7), random.uniform(-7, 7))
     if self.model == True and self.text == True:
         self.f.remove()
         self.newTextNodePath2.remove()
     a = random.uniform(-7, 7)
     b = random.uniform(-7, 7)
     c = random.uniform(-7, 7)
     pos = Vec3(a, b, c)
     tex = loader.loadTexture("cra/textures/e.jpeg")
     self.f = loader.loadModel("cra/models/ball1.egg")
     self.f.setTexGen(TextureStage.getDefault(), TexGenAttrib.MEyeSphereMap)
     self.f.setTexture(tex, 1)
     self.f.setPos(pos)
     self.f.setScale(1.5)
     self.f.reparentTo(render)
     self.f.setCollideMask(0)
     text = NUM
     newTextNode = TextNode("text")  # Create a new TextNode
     newTextNode.setText(text)  # Set the TextNode text
     newTextNode.setAlign(TextNode.ACenter)  # Set the text align
     newTextNode.setWordwrap(6.0)  # Set the word wrap
     text_generate = newTextNode.generate()  # Generate a NodePath
     self.newTextNodePath2 = render.attachNewNode(text_generate)  # Attach the NodePath to the render tree
     self.newTextNodePath2.setPos(a, b, (c + 0.3))
     self.newTextNodePath2.setColor(255, 0, 0, 1)
     self.newTextNodePath2.setScale(0.6)
     return pos
开发者ID:SaraQamar,项目名称:FYP,代码行数:28,代码来源:run.py

示例8: addball

    def addball(self, NUM):
	X =  "Person_pics/" + NUM + '.jpeg' 
	tex = loader.loadTexture(X)
	f = loader.loadModel("models/ball1.egg")
        f.setTexGen(TextureStage.getDefault(), TexGenAttrib.MEyeSphereMap)
        a = random.uniform((-8 + (self.addx)), (8 + self.addx))
        b = random.uniform((-8 + (self.addy)), (8 + self.addy))
        c = random.uniform((-8 + (self.addz)), (8 + self.addz))
        pos = Vec3(a,b,c)
        f.setTexture(tex, 1)
        f.setPos(pos)
        f.setScale(.8)
        f.reparentTo(render)
        f.setCollideMask(0)
        text = NUM
        newTextNode = TextNode('text') # Create a new TextNode
        newTextNode.setText(text) # Set the TextNode text
        newTextNode.setAlign(TextNode.ACenter) # Set the text align
        newTextNode.setWordwrap(6.0) # Set the word wrap
        text_generate = newTextNode.generate() # Generate a NodePath
        newTextNodePath = render.attachNewNode(text_generate) # Attach the NodePath to the render tree
        newTextNodePath.setPos(a,b,(c + 0.6))
        newTextNodePath.setColor(255, 0, 0,1)
        newTextNodePath.setScale(.5)
        return pos    
开发者ID:SaraQamar,项目名称:FYP,代码行数:25,代码来源:select_all_inclde_person_pic.py

示例9: CatalogItemPage

class CatalogItemPage(NodePath):
    def __init__(self, parent, category, pageNum):
        NodePath.__init__(self, parent.attachNewNode(category))

        self.parent = parent
        self.pageNum = pageNum
        self.category = category
        self.catalogItems = []
        self.itemFrames = []
        self.textNode = None

    def addCatalogItem(self, item):
        if not item in self.catalogItems:
            self.catalogItems.append(item)

    def setCatalogItems(self, catalogItems):
        self.catalogItems = catalogItems

    def generatePage(self):
        pageText = '%s - %s' % (self.category, self.pageNum)
        self.textNode = TextNode(pageText)
        self.textNode.setText(pageText)
        self.textNode.setFont(ToontownGlobals.getInterfaceFont())
        self.textNode = self.attachNewNode(self.textNode)
        self.textNode.setPos(*CatalogGlobals.ItemPageTextLoc)
        self.textNode.setScale(CatalogGlobals.ItemPageTextScale)
        self.textNode.setColor(0, 0, 0, 1)
        for (x, item) in enumerate(self.catalogItems):
            itemFrame = CatalogItemPanel(parent=self, parentCatalogScreen=self.parent, item=item)
            itemFrame.load()
            itemFrame.setPos(*CatalogGlobals.CatalogPropPos[x])
            self.itemFrames.append(itemFrame)

    def lockItems(self):
        for itemFrame in self.itemFrames:
            itemFrame.lockItem()

    def updateItems(self, gifting):
        for itemFrame in self.itemFrames:
            itemFrame.updateButtons(gifting)

    def cleanup(self):
        for item in self.catalogItems:
            if hasattr(item, 'destroy'):
                item.destroy()

        for itemFrame in self.itemFrames:
            itemFrame.destroy()

        NodePath.removeNode(self)
开发者ID:CalebSmith376,项目名称:src,代码行数:50,代码来源:CatalogItemPage.py

示例10: addball

 def addball(self, NUM):
     #pos = Vec3(random.uniform(-7, 7), random.uniform(-7, 7), random.uniform(-7, 7))
    
     
     a = random.uniform((-8 + (self.addx)), (8 + self.addx))
     b = random.uniform((-8 + (self.addy)), (8 + self.addy))
     c = random.uniform((-8 + (self.addz)), (8 + self.addz))
     pos = Vec3(a,b,c)
     f = loader.loadModel("models/ball")
     f.setPos(pos)
     f.setScale(.8)
     f.reparentTo(render)
     f.setCollideMask(0)
     text = NUM
     newTextNode = TextNode('text') # Create a new TextNode
     newTextNode.setText(text) # Set the TextNode text
     newTextNode.setAlign(TextNode.ACenter) # Set the text align
     newTextNode.setWordwrap(6.0) # Set the word wrap
     text_generate = newTextNode.generate() # Generate a NodePath
     newTextNodePath = render.attachNewNode(text_generate) # Attach the NodePath to the render tree
     newTextNodePath.setPos(a,b,(c + 0.6))
     newTextNodePath.setColor(255, 0, 0,1)
     newTextNodePath.setScale(2)
     #self.V = self.V + 1
     #self.negy = (10%(self.V))*(-7)
     #self.posy = (10%(self.V)+3)*(-7)
     return pos    
开发者ID:SaraQamar,项目名称:FYP,代码行数:27,代码来源:all_contacts_in_frame.py

示例11: createText

 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,代码行数:11,代码来源:PartyCogActivity.py

示例12: createDistanceLabel

 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,代码行数:11,代码来源:PartyCogActivity.py

示例13: center

    def center(self, prsn_name , m):
        if (m < 5):
            self.i = self.i + 1
            X = 'Person_pics/' + prsn_name + '.jpeg' 
	    tex = loader.loadTexture(X)
	    self.sphere = loader.loadModel("models/ball1")
	    self.sphere.setTexGen(TextureStage.getDefault(), TexGenAttrib.MEyeSphereMap)
	    self.sphere.setTexture(tex, 1)
            self.sphere.reparentTo(render)
            gx = self.sx
            y = self.sy
            z = self.sz
            pos = (gx,y,z)
            self.addx =gx
            self.addy =y
            self.addz =z
            self.sphere.setPos(1, self.sy, 1)
            self.sphere.setScale(.9)
            self.sy = -14*(self.i)
            
            
        else :
       
            x = m/5 
            j = m%5
            if ( j == 0):
                self.sy = 1
                self.i = 1
            else :
                self.sy = -14*(self.i)
                
               
            self.sx = 40*(x)
            self.sphere = loader.loadModel("models/ball1")
            self.sphere.reparentTo(render)
            gx = self.sx
            y = self.sy
            z = self.sz
            self.addx =gx
            self.addy =y
            self.addz =z
            
            pos = (gx, y, 1)
            self.sphere.setPos(pos)
            #self.sphere.setScale(.9)
            self.i = self.i + 1
            self.sphere.setScale(.9)
        text = prsn_name
        newTextNode = TextNode('text') # Create a new TextNode
        newTextNode.setText(text) # Set the TextNode text
        newTextNode.setAlign(TextNode.ACenter) # Set the text align
        newTextNode.setWordwrap(6.0) # Set the word wrap
        text_generate = newTextNode.generate() # Generate a NodePath
        newTextNodePath = render.attachNewNode(text_generate) # Attach the NodePath to the render tree
        newTextNodePath.setPos(gx, y, (z + 2))
        newTextNodePath.setColor(0, 0, 255,1)
        newTextNodePath.setScale(.5)
        return pos
开发者ID:SaraQamar,项目名称:FYP,代码行数:58,代码来源:history.py

示例14: __init__

 def __init__(self, text_color=(1,1,1), max_nr_rows=3, nr_char_per_row=20,
              frame_color=(0,0,0), frame_padding=0.4, frame_line_width=2,
              background_color=(1,1,0), background_padding=0.8):
     #print "TextBoard::init"
     # everything that belongs to this TextBoard will be stored under the root node
     self.root_node_path = render.attachNewNode(PandaNode(''))
     # create the text node that will be the TextBoard
     self.text_node = TextNode('')
     self.text_node_path = self.root_node_path.attachNewNode(self.text_node)
     self.set_max_nr_rows(max_nr_rows)
     r,g,b = text_color
     self.set_text_color(r, g, b)
     self.text_node.setAlign(TextNode.ALeft)  # TextNode.ALeft, TextNode.ACenterba
     letter_width, letter_height = self._compute_letter_size()
     self.max_row_length = nr_char_per_row * letter_width
     self.text_node.setWordwrap(self.max_row_length)
     width, height = self._compute_max_text_size()
     self.text_node_path.setPos(0.5*background_padding,-0.01,-letter_height)
     self.background_node_path = self.root_node_path.attachNewNode(PandaNode('background_node'))
     self._create_background(self.background_node_path, width+background_padding, height+background_padding+letter_height)
     self.frame_node_path = self.root_node_path.attachNewNode(PandaNode('frame_node'))
     self._create_frame(self.frame_node_path, width+background_padding, height+background_padding+letter_height)
     r,g,b = frame_color
     self.set_frame_color(r, g, b)
     self.set_frame_line_width(frame_line_width)
     r,g,b = background_color
     self.set_background_color(r, g, b)
开发者ID:JingLu92,项目名称:pyff,代码行数:27,代码来源:TextBoard.py

示例15: __init__

 def __init__(self, cr):
     DistributedMinigame.__init__(self, cr)
     self.gameFSM = ClassicFSM.ClassicFSM(
         "DistributedCogThiefGame",
         [
             State.State("off", self.enterOff, self.exitOff, ["play"]),
             State.State("play", self.enterPlay, self.exitPlay, ["cleanup"]),
             State.State("cleanup", self.enterCleanup, self.exitCleanup, []),
         ],
         "off",
         "cleanup",
     )
     self.addChildGameFSM(self.gameFSM)
     self.cameraTopView = (0, 0, 55, 0, -90.0, 0)
     self.barrels = []
     self.cogInfo = {}
     self.lastTimeControlPressed = 0
     self.stolenBarrels = []
     self.useOrthoWalk = base.config.GetBool("cog-thief-ortho", 1)
     self.resultIval = None
     self.gameIsEnding = False
     self.__textGen = TextNode("cogThiefGame")
     self.__textGen.setFont(ToontownGlobals.getSignFont())
     self.__textGen.setAlign(TextNode.ACenter)
     return
开发者ID:lolman8776,项目名称:ToontownInfinite,代码行数:25,代码来源:DistributedCogThiefGame.py


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