当前位置: 首页>>代码示例>>Python>>正文


Python Gui.setup方法代码示例

本文整理汇总了Python中gui.Gui.setup方法的典型用法代码示例。如果您正苦于以下问题:Python Gui.setup方法的具体用法?Python Gui.setup怎么用?Python Gui.setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gui.Gui的用法示例。


在下文中一共展示了Gui.setup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from gui import Gui [as 别名]
# 或者: from gui.Gui import setup [as 别名]
def main():

    # Construct the objects that will run the game.
    courier = Courier()
    world = World(courier)
    gui = Gui(courier, world)

    systems = [courier, world, gui]

    # Connect to the server and wait until the game is ready to begin.
    courier.setup()
    courier.login(world.setup)

    # Open up a window and get ready to start playing.
    clock = pygame.time.Clock()
    frequency = 40

    gui.setup()
    
    # Play the game!
    while world.still_playing():
        time = clock.tick(frequency) / 1000
        for system in systems:
            system.update(time)

    # Exit gracefully.
    for system in systems:
        system.teardown()
开发者ID:kxgames,项目名称:ClayPygeons,代码行数:30,代码来源:client.py

示例2: ClientGame

# 需要导入模块: from gui import Gui [as 别名]
# 或者: from gui.Gui import setup [as 别名]
class ClientGame (Engine):
    """ Plays the game. Does not have any game logic. It send player input to
    the server which will eventually tell the client's game what to do. """
    # Constructor {{{1
    def __init__ (self, loop, forum, world):
        print 'C: Begin game engine.'
        Engine.__init__ (self, loop)

        self.forum = forum
        self.world = world
        
        # Set up the relays.
        publisher = self.forum.get_publisher()
        subscriber = self.forum.get_subscriber()

        self.reflex = Reflex(self, subscriber, self.world)
        self.player_relay = PlayerRelay(self, publisher, self.world)

        self.gui = Gui(self.world, self.player_relay)

    def setup (self):
        self.reflex.setup()
        self.player_relay.setup()
        self.gui.setup()

        self.forum.lock()
    
    # Update {{{1
    def update (self, time):
        self.forum.update()
        self.reflex.update(time)
        self.player_relay.update(time)
        self.world.update(time)
        self.gui.update(time)

    # Methods {{{1
    def game_over(self):
        # Called by the Reflex?
        print 'Game over.'
        self.exit_engine()

    def successor (self):
        self.forum.unlock()
        return ClientPostgame(self.loop, self.forum, self.world, self.gui)
    
    def teardown (self):
        time.sleep(1)
开发者ID:alexmitchell,项目名称:PurplePeopleEater,代码行数:49,代码来源:engines.py


注:本文中的gui.Gui.setup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。