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


Python Panel.background_image方法代码示例

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


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

示例1: create_panels

# 需要导入模块: from panel import Panel [as 别名]
# 或者: from panel.Panel import background_image [as 别名]
    def create_panels(self):
        """
        Build game panels that move around and show at various model states.

        """

        score_panel = Panel(SCORE_BOX.size, DRAW_AREA)
        score_panel.background_image = pygame.image.load(data.load('puzzle_info_bg.png')).convert()
        score_panel.border_image = pygame.image.load(data.load('puzzle_info.png')).convert()
        score_panel.border_image.set_colorkey(color.magenta)
        score_panel.show_position = SCORE_BOX.topleft
        score_panel.hide_position = (- SCORE_BOX.width, 0)
        score_panel.hide(instant=True)
        self.panels['score'] = score_panel

        puzzle_panel = Panel(PUZZLE_POS.size, DRAW_AREA)
        puzzle_panel.background_image = pygame.image.load(data.load('puzzle_bg.png')).convert()
        puzzle_panel.border_image = pygame.image.load(data.load('puzzle.png')).convert()
        puzzle_panel.border_image.set_colorkey(color.magenta)
        puzzle_panel.show_position = PUZZLE_POS.topleft
        puzzle_panel.hide_position = DRAW_AREA.bottomright
        puzzle_panel.hide(instant=True)
        self.panels['puzzle'] = puzzle_panel

        arcade_panel = Panel(ARCADE_POS.size, DRAW_AREA)
        arcade_panel.background_image = pygame.image.load(data.load('arcade_bg.png')).convert()
        arcade_panel.border_image = pygame.image.load(data.load('arcade.png')).convert()
        arcade_panel.border_image.set_colorkey(color.magenta)
        earth = pygame.image.load(data.load('earth.png')).convert()
        earth.set_colorkey(color.magenta)
        somewhere_over_the_rainbow = (random.randint(0, ARCADE_POS.width), random.randint(0, ARCADE_POS.height))
        arcade_panel.background_image.blit(earth, somewhere_over_the_rainbow)
        arcade_panel.hide_position = (0, ARCADE_POS.height)
        arcade_panel.hide(instant=True)
        self.panels['arcade'] = arcade_panel

        results_screen = pygame.image.load(data.load('results.png')).convert()
        results_panel = Panel(results_screen.get_size(), DRAW_AREA)
        results_panel.background_image = results_screen
        results_panel.show_position = (
            (DRAW_AREA.width - results_panel.rect.width) / 2,
            (DRAW_AREA.height - results_panel.rect.height) / 2)
        results_panel.hide_position = (DRAW_AREA.width, 0)
        results_panel.hide(instant=True)
        self.panels['results'] = results_panel

        msg_panel = Panel(MESSAGE_POS.size, DRAW_AREA)
        msg_panel.background_image = pygame.image.load(data.load('messages_bg.png')).convert()
        msg_panel.border_image = pygame.image.load(data.load('messages.png')).convert()
        msg_panel.border_image.set_colorkey(color.magenta)
        msg_panel.show_position = MESSAGE_POS.topleft
        msg_panel.hide_position = DRAW_AREA.topright
        msg_panel.hide(instant=True)
        self.panels['messages'] = msg_panel
开发者ID:wesleywerner,项目名称:mooncrete,代码行数:56,代码来源:view.py


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