本文整理汇总了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)
示例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)
示例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
示例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")
示例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
示例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
示例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")
示例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)
示例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)
示例10: __init__
def __init__(self, image):
self.image = pygame.image.load(image).convert()
LcarsWidget.__init__(self, None, (0,0), None)