本文整理汇总了Python中direct.gui.DirectGui.DirectWaitBar.setTransparency方法的典型用法代码示例。如果您正苦于以下问题:Python DirectWaitBar.setTransparency方法的具体用法?Python DirectWaitBar.setTransparency怎么用?Python DirectWaitBar.setTransparency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.gui.DirectGui.DirectWaitBar
的用法示例。
在下文中一共展示了DirectWaitBar.setTransparency方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Hud
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import setTransparency [as 别名]
class Hud(DirectObject):
def __init__(self):
self.lifeBar1 = DirectWaitBar(
text = "Player1",
text_fg = (1,1,1,1),
text_pos = (-1.2, -0.18, 0),
text_align = TextNode.ALeft,
value = 100,
barColor = (0, 1, 0.25, 1),
barRelief = DGG.RAISED,
barBorderWidth = (0.03, 0.03),
borderWidth = (0.01, 0.01),
relief = DGG.RIDGE,
frameColor = (0.8,0.05,0.10,1),
frameSize = (-1.2, 0, -0.1, 0),
pos = (-0.2,0,base.a2dTop-0.15))
self.lifeBar1.setTransparency(1)
self.lifeBar2 = DirectWaitBar(
text = "Player2",
text_fg = (1,1,1,1),
text_pos = (1.2, -0.18, 0),
text_align = TextNode.ARight,
value = 100,
barColor = (0, 1, 0.25, 1),
barRelief = DGG.RAISED,
barBorderWidth = (0.03, 0.03),
borderWidth = (0.01, 0.01),
relief = DGG.RIDGE,
frameColor = (0.8,0.05,0.10,1),
frameSize = (0, 1.2, -0.1, 0),
pos = (0.2,0,base.a2dTop-0.15))
self.lifeBar2.setTransparency(1)
self.accept("hud_setLifeBarValue", self.setLifeBarValue)
self.hide()
def show(self):
self.lifeBar1["value"] = 100
self.lifeBar2["value"] = 100
self.lifeBar1.show()
self.lifeBar2.show()
def hide(self):
self.lifeBar1.hide()
self.lifeBar2.hide()
def setLifeBarValue(self, barNr, newValue):
if barNr == 0:
self.lifeBar1["value"] = newValue
elif barNr == 1:
self.lifeBar2["value"] = newValue