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


Python TextNode.getFrameActual方法代码示例

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


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

示例1: getTextSize

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import getFrameActual [as 别名]
def getTextSize(txt, style):
	tn = TextNode(txt)
	tn.setText(txt)
	tn.setFont(loader.loadFont(style['font']))
	tn.setSlant(style['slant'])
	#tn.setFont(style['font'])
	fontSize = style['font-size']
	lineHeight = tn.getLineHeight()
	f = tn.getFrameActual()
	return (tn.getWidth()*fontSize,\
		(f[3]-f[2])*fontSize,\
		lineHeight*fontSize,\
		(0, f[1]*fontSize, f[2]*fontSize, f[3]*fontSize))
开发者ID:rll,项目名称:labeling_tool,代码行数:15,代码来源:buttonjoe.py

示例2: WhisperPopup

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import getFrameActual [as 别名]

#.........这里部分代码省略.........
        if self.quitButton is not None:
            self.quitButton.destroy()
            self.quitButton = None

        self.contents.node().removeAllChildren()

        self.draw()

        if self.cell is not None:
            # We're in the margin display. Reposition our content, and update
            # the click region:
            self.reposition()
            self.updateClickRegion()
        else:
            # We aren't in the margin display. Disable the click region if one
            # is present:
            if self.region is not None:
                self.region.setActive(False)

    def draw(self):
        if self.isClickable():
            foreground, background = self.whisperColor[self.clickState]
        else:
            foreground, background = self.whisperColor[PGButton.SInactive]
        self.chatBalloon = ChatBalloon(
            NametagGlobals.chatBalloon2dModel,
            NametagGlobals.chatBalloon2dWidth,
            NametagGlobals.chatBalloon2dHeight, self.textNode,
            foreground=foreground, background=background
        )
        self.chatBalloon.reparentTo(self.contents)

        # Calculate the center of the TextNode:
        left, right, bottom, top = self.textNode.getFrameActual()
        center = self.contents.getRelativePoint(
            self.chatBalloon.textNodePath,
            ((left+right) / 2.0, 0, (bottom+top) / 2.0))

        # Translate the chat balloon along the inverse:
        self.chatBalloon.setPos(self.chatBalloon, -center)

        # Draw the quit button:
        self.quitButton = WhisperQuitButton(self)
        quitButtonNodePath = self.contents.attachNewNode(self.quitButton)

        # Move the quit button to the top right of the TextNode:
        quitButtonNodePath.setPos(self.contents.getRelativePoint(
            self.chatBalloon.textNodePath, (right, 0, top)))

        # Apply the quit button shift:
        quitButtonNodePath.setPos(quitButtonNodePath, self.QUIT_BUTTON_SHIFT)

        # Allow the quit button to close this whisper:
        self.quitButton.setClickEvent(self.quitEvent)

    def manage(self, marginManager):
        MarginVisible.manage(self, marginManager)

        self.timeoutTask = taskMgr.doMethodLater(
            self.timeout, self.unmanage, self.timeoutTaskName, [marginManager])

    def unmanage(self, marginManager):
        MarginVisible.unmanage(self, marginManager)

        self.destroy()
开发者ID:CalmBit,项目名称:ToonboxSource,代码行数:69,代码来源:WhisperPopup.py


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