def build_widget_display(self, border, base_image): # base image has already been built at this point image = add_border(base_image, border, Resources.get_image(border.image)) # only relative to the window # have to add widths and border AND screen position border_size = border.border_size deltax = border.rects.middle_left[2] + border_size deltay = border.rects.top_left[3] + border_size self.container.update_position(deltax, deltay) return image
def __init__(self, text, signal, align=Align.NONE): # make a label of the text - but we only want the image label = GuiLabel(text, (0, 0, 0), (214, 214, 214)).image # get the contents to render themselves border = Resources.configs.get(self.border_config) image = add_border(label, border, Resources.get_image(border.image)) rect = pygame.Rect(0, 0, image.get_width(), image.get_height()) super().__init__(rect, image, align, False) self.messages = [ pygame.MOUSEMOTION, pygame.MOUSEBUTTONUP, pygame.MOUSEBUTTONDOWN ] self.highlight = self.get_highlight() self.normal_image = self.image self.signal = signal self.changed = False
def from_image(image_name): image = Resources.get_image(image_name) return GuiImage(image)
def from_image(xpos, ypos, image): image = Resources.get_image(image) rect = pygame.Rect(xpos, ypos, image.get_width(), image.get_height()) return ImageNode(rect, image)