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


Python sprite.LcarsWidget类代码示例

本文整理汇总了Python中ui.widgets.sprite.LcarsWidget的典型用法代码示例。如果您正苦于以下问题:Python LcarsWidget类的具体用法?Python LcarsWidget怎么用?Python LcarsWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __init__

 def __init__(self, colour, style, pos, handler=None):
     image = pygame.image.load("assets/tab.png").convert()
     if (style == LcarsTab.STYLE_RIGHT):
         image = pygame.transform.flip(image, False, True)
     
     size = (image.get_rect().width, image.get_rect().height)
     LcarsWidget.__init__(self, colour, pos, size, handler)
     self.image = image
     self.applyColour(colour)
开发者ID:tobykurien,项目名称:rpi_lcars,代码行数:9,代码来源:lcars_widgets.py

示例2: __init__

    def __init__(self, colour, style, pos):
        script_dir = dirname(__file__)
        ipath = join(script_dir, '../../assets/tab.png')
        image = pygame.image.load(ipath).convert()
        if (style == LcarsTab.STYLE_RIGHT):
            image = pygame.transform.flip(image, False, True)

        size = (image.get_rect().width, image.get_rect().height)
        LcarsWidget.__init__(self, colour, pos, size)
        self.image = image
        self.applyColour(colour)
开发者ID:astrobokonon,项目名称:rpi_lcars,代码行数:11,代码来源:lcars_widgets.py

示例3: handleEvent

    def handleEvent(self, event, clock):
        handled = False
        if (event.type == MOUSEBUTTONDOWN and self.rect.collidepoint(event.pos)):
            handled = True

        if (event.type == MOUSEBUTTONUP):
            if self.handler:
                self.handler(self, event, clock)
                handled = True

        LcarsWidget.handleEvent(self, event, clock)
        return handled
开发者ID:psychomugs,项目名称:lcars_probe,代码行数:12,代码来源:lcars_widgets.py

示例4: __init__

    def __init__(self, colour, pos, text, handler=None):
        self.handler = handler
        image = pygame.image.load("assets/button.png").convert()
        size = (image.get_rect().width, image.get_rect().height)
        font = Font("assets/swiss911.ttf", 19)
        textImage = font.render(text, False, colours.BLACK)
        image.blit(textImage, 
                   (image.get_rect().width - textImage.get_rect().width - 10,
                    image.get_rect().height - textImage.get_rect().height - 5))

        self.image = image
        self.colour = colour
        LcarsWidget.__init__(self, colour, pos, size)
        self.applyColour(colour)
        self.highlighted = False
        self.beep = Sound("assets/audio/panel/202.wav")
开发者ID:elijaheac,项目名称:rpi_lcars,代码行数:16,代码来源:lcars_widgets.py

示例5: handleEvent

    def handleEvent(self, event, clock):
        handled = False
        
        if (event.type == MOUSEBUTTONDOWN and self.rect.collidepoint(event.pos)):
            self.applyColour(colours.WHITE)
            self.highlighted = True
            self.beep.play()
            handled = True

        if (event.type == MOUSEBUTTONUP and self.highlighted):
            self.applyColour(self.colour)
            if self.handler:
                self.handler(self, event, clock)
                handled = True
            
        LcarsWidget.handleEvent(self, event, clock)
        return handled
开发者ID:elijaheac,项目名称:rpi_lcars,代码行数:17,代码来源:lcars_widgets.py

示例6: handleEvent

    def handleEvent(self, event, clock):
        handled = False

        if (event.type == MOUSEBUTTONDOWN and
           self.rect.collidepoint(event.pos)):
            self.applyColour(colours.WHITE)
            self.highlighted = True
            # NOTE: Should put the sounds behind a global/config param
#            self.beep.play()
            handled = True

        if (event.type == MOUSEBUTTONUP and self.highlighted):
            self.applyColour(self.colour)
            if self.handler:
                self.handler(self, event, clock)
                handled = True

        LcarsWidget.handleEvent(self, event, clock)
        return handled
开发者ID:astrobokonon,项目名称:rpi_lcars,代码行数:19,代码来源:lcars_widgets.py

示例7: __init__

    def __init__(self, colour, pos, text, handler=None, rectSize=None):
        if rectSize == None:
            image = pygame.image.load("assets/button.png").convert_alpha()
            size = (image.get_rect().width, image.get_rect().height)
        else:
            size = rectSize
            image = pygame.Surface(rectSize).convert_alpha()
            image.fill(colour)

        self.colour = colour
        self.image = image
        font = Font("assets/swiss911.ttf", 19)
        textImage = font.render(text, False, colours.BLACK)
        image.blit(textImage, 
                (image.get_rect().width - textImage.get_rect().width - 10,
                    image.get_rect().height - textImage.get_rect().height - 5))
    
        LcarsWidget.__init__(self, colour, pos, size, handler)
        self.applyColour(colour)
        self.highlighted = False
        self.beep = Sound("assets/audio/panel/202.wav")
开发者ID:pstray,项目名称:rpi_lcars,代码行数:21,代码来源:lcars_widgets.py

示例8: __init__

 def __init__(self, imagefilename, pos, duration=-1):
     self.image = GIFImage(imagefilename, duration)
     self.pos = pos
     size = (self.image.get_rect().width, self.image.get_rect().height)
     LcarsWidget.__init__(self, None, pos, size)
开发者ID:RXCORE,项目名称:rpi_lcars,代码行数:5,代码来源:gifimage.py

示例9: __init__

    def __init__(self, image, pos, handler=None):
        self.handler = handler

        self.image = pygame.image.load(image).convert()
        LcarsWidget.__init__(self, None, pos, None)
开发者ID:psychomugs,项目名称:lcars_probe,代码行数:5,代码来源:lcars_widgets.py

示例10: __init__

 def __init__(self, image):
     self.image = pygame.image.load(image).convert()
     LcarsWidget.__init__(self, None, (0,0), None)
开发者ID:pstray,项目名称:rpi_lcars,代码行数:3,代码来源:background.py


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