本文整理汇总了Python中direct.gui.DirectFrame.DirectFrame.destroy方法的典型用法代码示例。如果您正苦于以下问题:Python DirectFrame.destroy方法的具体用法?Python DirectFrame.destroy怎么用?Python DirectFrame.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.gui.DirectFrame.DirectFrame
的用法示例。
在下文中一共展示了DirectFrame.destroy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from direct.gui.DirectFrame import DirectFrame [as 别名]
# 或者: from direct.gui.DirectFrame.DirectFrame 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: TrickOrTreatTargetEffect
# 需要导入模块: from direct.gui.DirectFrame import DirectFrame [as 别名]
# 或者: from direct.gui.DirectFrame.DirectFrame import destroy [as 别名]
class TrickOrTreatTargetEffect(ScavengerHuntEffect):
def __init__(self, beanAmount):
ScavengerHuntEffect.__init__(self, beanAmount)
if beanAmount > 0:
self.pumpkin = DirectFrame(parent=self.eventImage, relief=None, image=ScavengerHuntEffect.images.find('**/tot_pumpkin_tall'))
def attemptFailedMsg(self):
pLabel = DirectLabel(parent=self.npRoot, relief=None, pos=(0.0, 0.0, -0.15), text=TTLocalizer.TrickOrTreatMsg, text_fg=(0.95, 0.5, 0.0, 1.0), text_scale=0.12, text_font=ToontownGlobals.getSignFont())
def destroy(self):
if hasattr(self, 'pumpkin') and self.pumpkin:
self.pumpkin.destroy()
ScavengerHuntEffect.destroy(self)
示例3: WinterCarolingEffect
# 需要导入模块: from direct.gui.DirectFrame import DirectFrame [as 别名]
# 或者: from direct.gui.DirectFrame.DirectFrame import destroy [as 别名]
class WinterCarolingEffect(ScavengerHuntEffect):
def __init__(self, beanAmount):
ScavengerHuntEffect.__init__(self, beanAmount)
if beanAmount > 0:
sm = loader.loadModel('phase_5.5/models/estate/tt_m_prp_ext_snowman_icon')
self.snowman = DirectFrame(parent=self.eventImage, relief=None, image=sm, scale=20.0)
def attemptFailedMsg(self):
pLabel = DirectLabel(parent=self.npRoot, relief=None, pos=(0.0, 0.0, -0.15), text=TTLocalizer.WinterCarolingMsg, text_fg=(0.9, 0.9, 1.0, 1.0), text_scale=0.12, text_font=ToontownGlobals.getSignFont())
def destroy(self):
if hasattr(self, 'snowman') and self.snowman:
self.snowman.destroy()
ScavengerHuntEffect.destroy(self)
示例4: PiratesDownloadWatcher
# 需要导入模块: from direct.gui.DirectFrame import DirectFrame [as 别名]
# 或者: from direct.gui.DirectFrame.DirectFrame 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()
示例5: StoryManager
# 需要导入模块: from direct.gui.DirectFrame import DirectFrame [as 别名]
# 或者: from direct.gui.DirectFrame.DirectFrame import destroy [as 别名]
class StoryManager(SogalForm):
"""Story controller of Sogal
Controls the whole story scene.
Mainly for logic control
And graphics is on other
Attributes:
gameTextBox: the current GameTextBox, useful for user scripting
storyView: the current StoryView, useful for user scripting
"""
script_space = {}
_currentDump = None
__destroyed = False
def __init__(self):
self.step = 0 #shows how many commands line it had run
self.scrStack = []
self.commandList = []
self.__currentPtr = None
if not runtime_data.RuntimeData.command_ptr:
self.nextPtr = 0
else: self.nextPtr = runtime_data.RuntimeData.command_ptr
if not runtime_data.RuntimeData.command_stack:
runtime_data.RuntimeData.command_stack = self.scrStack
else: self.scrStack = runtime_data.RuntimeData.command_stack
if not runtime_data.RuntimeData.command_list:
runtime_data.RuntimeData.command_list = self.commandList
else: self.commandList = runtime_data.RuntimeData.command_list
self._frame = DirectFrame(parent = aspect2d) # @UndefinedVariable pydev在傲娇而已不用管
self._frame.setTransparency(TransparencyAttrib.MAlpha)
self.storyView = StoryView()
self.audioPlayer = base.audioPlayer # @UndefinedVariable pydev在傲娇而已不用管
self.menu = StoryMenuBar()
self.gameTextBox = GameTextBox()
self.textHistory = TextHistory()
self.button_auto = self.menu.addButton(text = 'Auto',state = DGG.NORMAL,command = self.autoPlayButton)
self.button_history = self.menu.addButton(text = 'History',state = DGG.NORMAL,command = self.showTextHistoryButton)
self.button_skip = self.menu.addButton(text = 'Skip',state = DGG.DISABLED,command = self.startSkippingButton)
self.button_lastchoice = self.menu.addButton(text = 'Last Choice',state = DGG.DISABLED,command = self.lastChoice)
self.button_save = self.menu.addButton(text = 'Save',state = DGG.DISABLED, command = self.saveButton)
self.button_load = self.menu.addButton(text = 'Load',state = DGG.NORMAL,command = self.loadButton)
self.button_quicksave = self.menu.addButton(text = 'Quick Save',state = DGG.DISABLED,command = self.quickSaveButton)
self.button_quickload = self.menu.addButton(text = 'Quick Load',state = DGG.DISABLED,command = self.quickLoadButton)
self.button_config = self.menu.addButton(text = 'Options', state = DGG.NORMAL, command = self._configButton)
self.button_title = self.menu.addButton(text = 'Title',state = DGG.NORMAL,command = self.returnToTitle)
self._inputReady = True
self.__arrow_shown = False
self._choiceReady = True
self._currentMessage = ''
self.__currentSelection = None
self.__finishing = False
self.__lock = Lock()
self.forcejump = False
self.__autoInput = False
self.__focused = False
self.intervals = []
self.__skipping = False
self.__autoplaying = False
self.__autoInterval = None
self.__autoplaystep = None
self.mapScriptSpace()
SogalForm.__init__(self)
self.show()
taskMgr.add(self.loopTask,'story_manager_loop',sort = 2,priority = 1) # @UndefinedVariable 傲娇的pydev……因为panda3D的"黑魔法"……
taskMgr.doMethodLater(runtime_data.game_settings['jump_span'],self.__jumpCheck,'story_jump_check', sort = 5, priority = 1) # @UndefinedVariable
def focused(self):
if not self.__focused:
self.accept('mouse1', self.input, [1])
self.accept('enter', self.input, [1])
self.accept('mouse3', self.input, [3])
self.accept('wheel_up', self.showTextHistory)
self.accept('escape', self.showMenu)
self.accept('control',self.setForceJump, [True])
self.accept('control-up',self.setForceJump, [False])
SogalForm.focused(self)
self.__focused = True
def defocused(self):
#.........这里部分代码省略.........
示例6: SogalDialog
# 需要导入模块: from direct.gui.DirectFrame import DirectFrame [as 别名]
# 或者: from direct.gui.DirectFrame.DirectFrame import destroy [as 别名]
class SogalDialog(SogalForm):
'''
A dialog that derived from SogalForm
(Which contains a DirectDialog)
'''
def __init__(self,
enableMask = True, #NOTE THAT IT IS TRUE BY DEFAULT
autoDestroy = True,
sortType = 0, #0 for horizontal, 1 for vertical
margin = 0.2,
textList = ['OK','Cancel'],
enablesList = None,
command = None,
frameSize = (-0.6,0.6,-0.45,0.45),
buttonSize = BUTTON_SIZE,
text = '',
textPos = (0,0.2),
startPos = (-0.4,0,-0.2),
extraArgs = [],
style = None,
fadeScreen = 0.5,
backgroundColor = None,
**kwargs):
if backgroundColor:
bgColor = backgroundColor
elif fadeScreen is not None:
bgColor = (0,0,0,fadeScreen)
else:
bgColor = None
SogalForm.__init__(self,enableMask = enableMask,backgroundColor=bgColor, **kwargs)
if enableMask:
self.reparentTo(aspect2d, sort = 1000)
if not style:
self.__style = base.getStyle()
else:
self.__style = color_themes.styles[style]
self.__frame = DirectFrame(parent = self,frameSize = frameSize,**self.__style['hardframe'])
self.__buttonList = []#DirectButton(parent = self, s)
self.__text = OnscreenText(parent = self,text = text ,pos = textPos, **self.__style['text'])
self.__command = command
self.__autoDestroy = autoDestroy
self._extraArgs = extraArgs
if sortType == 0:
self.__box = HLayout(margin = margin)
else: self.__box = VLayout(margin = margin)
self.__box.reparentTo(self)
self.__box.setPos(startPos)
for i in range(len(textList)):
btn = DirectButton(text = textList[i], command = self.buttonCommand(i),frameSize = buttonSize, **self.__style['button'])
self.__buttonList.append(btn)
self.__box.append(btn)
if enablesList:
for i in range(len(enablesList)):
if i >= len(self.__buttonList):
break
if enablesList[i]:
self.__buttonList[i]['state'] = DGG.NORMAL
else: self.__buttonList[i]['state'] = DGG.DISABLED
self.show()
def buttonCommand(self, i):
commandindex = i
def process():
if self.__command:
self.__command(commandindex, *self._extraArgs)
if self.__autoDestroy:
self.close()
return process
def close(self):
for btn in self.__buttonList:
btn['state'] = DGG.DISABLED
if self._getFading():
seq = Sequence(Func(self.hide),
Wait(self._getFadingDuration()+2),
Func(self.destroy),
)
seq.start()
else: self.destroy()
def destroy(self):
for btn in self.__buttonList:
btn.destroy()
self.__frame.destroy()
self.__box.removeNode()
SogalForm.destroy(self)