本文整理汇总了Python中ui.UI.add_button方法的典型用法代码示例。如果您正苦于以下问题:Python UI.add_button方法的具体用法?Python UI.add_button怎么用?Python UI.add_button使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ui.UI
的用法示例。
在下文中一共展示了UI.add_button方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GameWindow
# 需要导入模块: from ui import UI [as 别名]
# 或者: from ui.UI import add_button [as 别名]
#.........这里部分代码省略.........
down=down_static,
left=left_static,
right=right_static,
up=up_static,
leftdown=ld_static,
rightdown=rd_static,
leftup=lu_static,
rightup=ru_static
)
logger.info("Finished loading player animations.")
def get_anim(self, name):
try:
return self.animator.get_anim(name)
except KeyError:
logger.error("No animation by name {} found".format(name))
def load_map_files(self):
self.maplist = sorted(glob.glob(os.path.join(RES_PATH, '*.tmx')))
try:
self.selected_mapfile = self.maplist[0]
except IndexError:
logger.error("No map files found!")
self.selected_mapfile = None
def set_reticule(self, reticule):
if reticule == "projectile":
self.set_mouse_cursor(self.reticules["projectile"])
else:
self.set_mouse_cursor(self.reticules["default"])
def build_ui(self):
self.ui = UI(self)
self.ui.add_button(
self.width - 32, self.height - 16, text="Exit",
cb=pyglet.app.exit
)
self.ui.add_bar(
self.width - 100, 50,
text="Health", width=200, height=20,
color="red", shows="hp"
)
self.ui.add_bar(
self.width - 100, 30,
text="Stamina", width=200, height=20,
color="green", shows="sta"
)
self.ui.add_bar(
self.width - 100, 10,
text="Mana", width=200, height=20,
color="blue", shows="mp"
)
pyglet.clock.schedule_interval(self.ui.update, 1.0 / FPS)
def update_offset(self, dx=False, dy=False):
self.offset_x += dx
self.offset_y += dy
self.update_display_dungeon()
def set_offset(self, x, y):
self.offset_x, self.offset_y = x, y
self.update_display_dungeon()
def get_windowpos(self, x, y, check=False, tol=0, precise=False):
if check:
if (