本文整理汇总了Python中direct.gui.DirectLabel.DirectLabel.destroy方法的典型用法代码示例。如果您正苦于以下问题:Python DirectLabel.destroy方法的具体用法?Python DirectLabel.destroy怎么用?Python DirectLabel.destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.gui.DirectLabel.DirectLabel
的用法示例。
在下文中一共展示了DirectLabel.destroy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from direct.gui.DirectLabel import DirectLabel [as 别名]
# 或者: from direct.gui.DirectLabel.DirectLabel import destroy [as 别名]
class ScavengerHuntEffect:
images = None
def __init__(self, beanAmount):
if not ScavengerHuntEffect.images:
ScavengerHuntEffect.images = loader.loadModel('phase_4/models/props/tot_jar')
self.npRoot = DirectFrame(parent=aspect2d, relief=None, scale=0.75, pos=(0, 0, 0.6))
if beanAmount > 0:
self.npRoot.setColorScale(VBase4(1, 1, 1, 0))
self.jar = DirectFrame(parent=self.npRoot, relief=None, image=ScavengerHuntEffect.images.find('**/tot_jar'))
self.jar.hide()
self.eventImage = NodePath('EventImage')
self.eventImage.reparentTo(self.npRoot)
self.countLabel = DirectLabel(parent=self.jar, relief=None, text='+0', text_pos=(0.02, -0.2), text_scale=0.25, text_fg=(0.95, 0.0, 0, 1), text_font=ToontownGlobals.getSignFont())
def countUp(t, startVal, endVal):
beanCountStr = startVal + t * (endVal - startVal)
self.countLabel['text'] = '+' + `(int(beanCountStr))`
def setCountColor(color):
self.countLabel['text_fg'] = color
self.track = Sequence(LerpColorScaleInterval(self.npRoot, 1, colorScale=VBase4(1, 1, 1, 1), startColorScale=VBase4(1, 1, 1, 0)), Wait(1), Func(self.jar.show), LerpColorScaleInterval(self.eventImage, 1, colorScale=VBase4(1, 1, 1, 0), startColorScale=VBase4(1, 1, 1, 1)), Parallel(LerpScaleInterval(self.npRoot, 1, scale=0.5, startScale=0.75), LerpPosInterval(self.npRoot, 1, pos=VBase3(-0.9, 0, -0.83))), LerpFunc(countUp, duration=2, extraArgs=[0, beanAmount]), Func(setCountColor, VBase4(0.95, 0.95, 0, 1)), Wait(3), Func(self.destroy))
else:
self.npRoot.setColorScale(VBase4(1, 1, 1, 0))
self.attemptFailedMsg()
self.track = Sequence(LerpColorScaleInterval(self.npRoot, 1, colorScale=VBase4(1, 1, 1, 1), startColorScale=VBase4(1, 1, 1, 0)), Wait(5), LerpColorScaleInterval(self.npRoot, 1, colorScale=VBase4(1, 1, 1, 0), startColorScale=VBase4(1, 1, 1, 1)), Func(self.destroy))
def play(self):
if self.npRoot:
self.track.start()
def stop(self):
if self.track != None and self.track.isPlaying():
self.track.finish()
def destroy(self):
self.stop()
self.track = None
if hasattr(self, 'eventImage') and self.eventImage:
self.eventImage.detachNode()
del self.eventImage
if hasattr(self, 'countLabel') and self.countLabel:
self.countLabel.destroy()
del self.countLabel
if hasattr(self, 'jar') and self.jar:
self.jar.destroy()
del self.jar
if hasattr(self, 'npRoot') and self.npRoot:
self.npRoot.destroy()
del self.npRoot
示例2: PiratesDownloadWatcher
# 需要导入模块: from direct.gui.DirectLabel import DirectLabel [as 别名]
# 或者: from direct.gui.DirectLabel.DirectLabel import destroy [as 别名]
class PiratesDownloadWatcher(DownloadWatcher.DownloadWatcher):
positions = [
(Point3(1, 0, 0.90000000000000002), Point3(1, 0, 0.90000000000000002)),
(Point3(1, 0, 0.90000000000000002), Point3(1, 0, 0.90000000000000002)),
(Point3(1, 0, 0.90000000000000002), Point3(1, 0, 0.90000000000000002))]
def __init__(self, phaseNames):
self.phaseNames = phaseNames
self.model = loader.loadModel('models/gui/pir_m_gui_gen_loadingBar')
bar = self.model.findTexture('pir_t_gui_gen_loadingBar')
self.model.find('**/loading_bar').hide()
self.topFrame = DirectFrame(parent = base.a2dTopRight, pos = (-0.80000000000000004, 0, -0.10000000000000001), sortOrder = NO_FADE_SORT_INDEX + 1)
self.text = DirectLabel(relief = None, parent = self.topFrame, guiId = 'DownloadWatcherText', pos = (0, 0, 0), text = ' ', text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_scale = 0.040000000000000001, textMayChange = 1, text_align = TextNode.ARight, text_pos = (0.17000000000000001, 0), sortOrder = 2)
self.bar = DirectWaitBar(relief = None, parent = self.topFrame, guiId = 'DownloadWatcherBar', pos = (0, 0, 0), frameSize = (-0.40000000000000002, 0.38, -0.044999999999999998, 0.065000000000000002), borderWidth = (0.02, 0.02), range = 100, frameColor = (1, 1, 1, 1), barColor = (0, 0.29999999999999999, 0, 1), barTexture = bar, geom = self.model, geom_scale = 0.089999999999999997, geom_pos = (-0.014, 0, 0.01), text = '0%', text_scale = 0.040000000000000001, text_fg = (1, 1, 1, 1), text_align = TextNode.ALeft, text_pos = (0.19, 0), sortOrder = 1)
self.bgFrame = DirectFrame(relief = DGG.FLAT, parent = self.topFrame, pos = (0, 0, 0), frameColor = (0.5, 0.27000000000000002, 0.35999999999999999, 0.20000000000000001), frameSize = (-0.44, 0.39000000000000001, -0.035999999999999997, 0.056000000000000001), borderWidth = (0.02, 0.02), scale = 0.90000000000000002, sortOrder = 0)
self.accept('launcherPercentPhaseComplete', self.update)
def update(self, phase, percent, reqByteRate, actualByteRate):
phaseName = self.phaseNames[phase]
self.text['text'] = OTPLocalizer.DownloadWatcherUpdate % phaseName + ' -'
self.bar['text'] = '%s %%' % percent
self.bar['value'] = percent
def foreground(self):
self.topFrame.reparentTo(base.a2dpTopRight)
self.topFrame.setBin('gui-fixed', 55)
self.topFrame['sortOrder'] = NO_FADE_SORT_INDEX + 1
def background(self):
self.topFrame.reparentTo(base.a2dTopRight)
self.topFrame.setBin('unsorted', 49)
self.topFrame['sortOrder'] = -1
def cleanup(self):
self.text.destroy()
self.bar.destroy()
self.bgFrame.destroy()
self.topFrame.destroy()
self.ignoreAll()
示例3: HUD
# 需要导入模块: from direct.gui.DirectLabel import DirectLabel [as 别名]
# 或者: from direct.gui.DirectLabel.DirectLabel import destroy [as 别名]
class HUD():
def __init__(self):
self.canPlantLabel = DirectLabel(
frameColor=(0, 0, 0, 0.25),
text_fg=(1, 1, 1, 1),
scale=0.15,
pos=(0, 0, 0.25),
pad=(0.2,0.2),
text=_("Plant Seed"))
self.canPlantLabel.setTransparency(True)
self.canPlantLabel.reparentTo(base.a2dBottomCenter)
self.canPlantLabel.hide()
self.speekLabel = DirectLabel(
frameColor=(0, 0, 0, 0.25),
text_fg=(1, 1, 1, 1),
scale=0.15,
pos=(0, 0, 0.5),
pad=(0.2,0.2),
text="...")
self.speekLabel.reparentTo(render)
self.speekLabel.hide()
self.speekLabel.setTransparency(True)
self.speekLabel.setEffect(BillboardEffect.makePointEye())
self.speekLabel.setBin("fixed", 11)
self.speekLabel.setDepthWrite(False)
self.storyText = DirectLabel(
frameColor=(0, 0, 0, 0.25),
text_fg=(1, 1, 1, 1),
scale=0.08,
pos=(0, 0, 0.25),
pad=(0.2,0.2),
text="Story text")
self.storyText.setTransparency(True)
self.storyText.reparentTo(base.a2dBottomCenter)
self.storyText.hide()
self.points = DirectLabel(
frameColor=(0, 0, 0, 0.25),
text_fg=(1, 1, 1, 1),
scale=0.075,
pos=(0.05, 0, -0.1),
pad=(0.2,0.2),
text_align=TextNode.ALeft,
text=_("Points: %d")%0)
self.points.setTransparency(True)
self.points.reparentTo(base.a2dTopLeft)
self.playerWater = DirectLabel(
frameColor=(0, 0, 0, 0.25),
text_fg=(1, 1, 1, 1),
scale=0.075,
pos=(0.05, 0, -0.2),
pad=(0.2,0.2),
text_align=TextNode.ALeft,
text=_("Remaining Water: %d")%100)
self.playerWater.setTransparency(True)
self.playerWater.reparentTo(base.a2dTopLeft)
self.helpInfo = DirectLabel(
frameColor=(0, 0, 0, 0.25),
text_fg=(1, 1, 1, 1),
scale=0.075,
pos=(-0.05, 0, -0.1),
pad=(0.2,0.2),
text_align=TextNode.ARight,
text=_("F1 - show help"))
self.helpInfo.setTransparency(True)
self.helpInfo.reparentTo(base.a2dTopRight)
self.hide()
def show(self):
self.points.show()
self.playerWater.show()
self.helpInfo.show()
def hide(self):
self.points.hide()
self.playerWater.hide()
self.helpInfo.hide()
def hideAll(self):
self.canPlantLabel.hide()
self.speekLabel.hide()
self.points.hide()
self.playerWater.hide()
self.helpInfo.hide()
def showStory(self):
self.storyText.show()
def hideStory(self):
self.storyText.hide()
def cleanup(self):
self.hideAll()
self.canPlantLabel.destroy()
#.........这里部分代码省略.........