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


Python DirectLabel.destroy方法代码示例

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


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

示例1: MiniScoreItemGui

# 需要导入模块: from direct.gui import DirectLabel [as 别名]
# 或者: from direct.gui.DirectLabel import destroy [as 别名]
class MiniScoreItemGui(DirectFrame.DirectFrame):
    Width = PiratesGuiGlobals.PVPPanelWidth - PiratesGuiGlobals.GridSize
    Height = 0.055
    
    def __init__(self, scoreValue, parent = None, world = None, itemColorScale = None, blink = False, **kw):
        optiondefs = (('state', DGG.NORMAL, None), ('frameColor', (0, 0, 0, 0.0), None), ('borderWidth', PiratesGuiGlobals.BorderWidth, None), ('frameSize', (0.0, MiniScoreItemGui.Width, 0.0, MiniScoreItemGui.Height), None))
        self.defineoptions(kw, optiondefs)
        DirectFrame.DirectFrame.__init__(self, parent)
        self.initialiseoptions(MiniScoreItemGui)
        self.scoreValue = scoreValue
        self.world = world
        self.itemColorScale = itemColorScale
        self.blink = blink
        self.scaleSeq = None
        self._createIface()

    
    def destroy(self):
        self._destroyIface()
        DirectFrame.DirectFrame.destroy(self)
        del self.scoreValue
        self.ignoreAll()

    
    def _createIface(self):
        textFg = PiratesGuiGlobals.TextFG1
        if self.world != None:
            scoreText = self.world.getScoreText(self.scoreValue)
        else:
            scoreText = ''
        self.descText = DirectLabel(parent = self, relief = None, text = scoreText, text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = textFg, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (0.040000000000000001, 0, 0.014999999999999999))
        if self.itemColorScale:
            self.colorLabel(self.itemColorScale)
        
        if self.blink:
            textPos = self.descText['text_pos']
            textPosX = textPos[0]
            textPosY = textPos[1]
            self.scaleSeq = Parallel(Sequence(LerpFunctionInterval(self.descText.setScale, duration = 0.20000000000000001, toData = 1.05, fromData = 1.0, blendType = 'easeInOut'), LerpFunctionInterval(self.descText.setScale, duration = 0.69999999999999996, toData = 1.0, fromData = 1.05, blendType = 'easeInOut')), Sequence(Func(self.colorLabel, (1, 1, 1, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 0, 0, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 1, 1, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 0, 0, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 1, 1, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 0, 0, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 1, 1, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, PiratesGuiGlobals.TextFG1), Func(self.moveLabel, (textPosX, textPosY))))
            self.scaleSeq.start()
        

    
    def moveLabel(self, xy):
        randX = random.random() * 0.0050000000000000001 + 0.0050000000000000001
        randY = random.random() * 0.0050000000000000001 + 0.0050000000000000001
        self.descText['text_pos'] = (xy[0] + randX, xy[1] + randY)

    
    def colorLabel(self, color):
        self.descText['text_fg'] = color

    
    def shakeItUp(self, .2):
        (x, y, r, g, b, a) = .2
        self.colorLabel((r, g, b, a))
        randX = random.random() * 0.0050000000000000001 + 0.0050000000000000001
        randY = random.random() * 0.0050000000000000001 + 0.0050000000000000001
        self.moveLabel((x + randX, y + randY))
        Wait(0.050000000000000003)
        randX = random.random() * 0.0050000000000000001 + 0.0050000000000000001
        randY = random.random() * 0.0050000000000000001 + 0.0050000000000000001
        self.moveLabel((x + randX, y + randY))
        Wait(0.050000000000000003)

    
    def _destroyIface(self):
        if self.scaleSeq:
            self.scaleSeq.finish()
            self.scaleSeq = None
        
        self.descText.destroy()
        del self.descText
开发者ID:PiratesOnline,项目名称:PiratesOfTheCarribeanOnline,代码行数:75,代码来源:MiniScoreItemGui.py


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