當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。