本文整理汇总了Python中ui.UI.transition方法的典型用法代码示例。如果您正苦于以下问题:Python UI.transition方法的具体用法?Python UI.transition怎么用?Python UI.transition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ui.UI
的用法示例。
在下文中一共展示了UI.transition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from ui import UI [as 别名]
# 或者: from ui.UI import transition [as 别名]
class State:
def __init__(self):
"""Create a reference to the UI, and establish the default nextState."""
self.ui = UI(self)
self.nextState = None
def start(self):
"""Start the UI"""
self.ui.start()
self.ui = None
def quit(self):
"""Perform any cleanup before exiting the current state."""
pass
def setup(self):
"""Hook: Create objects that know how to draw themselves."""
pass
def update(self, screen):
"""Hook: Draw things on the screen that change with every draw loop
(animations)."""
pass
def handle(self, event):
"""Hook: Handle event."""
pass
def get_next_state(self):
"""Return the state to which to transition."""
return self.nextState
def transition(self):
"""Transition to the next state."""
self.quit()
next_state = self.get_next_state()
self.ui.transition()