def updateSurface(self): surface = pygame.surface.Surface((300, 100)) surface.fill((247, 190, 129)) add_border.add_border(surface, (0, 0, 0), 4, 4, 4, 4) RenderText = self.__FONT.render(self.__TITLE, 0, (0, 0, 0)) TW, TH = RenderText.get_size() textX = 300 / 2 - TW / 2 textY = 100 / 2 - TH / 2 surface.blit(RenderText, (textX, textY)) if (self.image != None): TW, TH = self.image.get_size() imageX = 300 / 2 - TW / 2 imageY = 100 / 2 - TH / 2 surface.blit(self.image, (imageX, imageY)) final_surface = pygame.transform.scale( surface, (int(300 * self.__ZOOM), int(100 * self.__ZOOM))) self.UpdateSurface(final_surface)
def getBorder(structure): image = GetImageByStructure(structure["structure"]) from gui import add_border final = add_border.add_border(image, structure["color"], structure["b1"], structure["b2"], structure["b3"], structure["b4"]) return final
def GenerateNormal(self): self.x, self.y = self.OriginalPosition Surface = pygame.surface.Surface(self.NormalSize) if not self.Gradient: Surface.fill(self.Background) else: Gradient.FillGradient(Surface, self.Background[0], self.Background[1]) Surface = add_border.add_border(Surface, (0, 0, 0), 2, 2, 2, 2) Text = self.UbuntuBoldSS.render(self.Title, 0, (0, 0, 0)) TextPosition = Clasic.GetCenterPosition(Surface, Text) Surface.blit(Text, TextPosition) self.UpdateSurface(Surface)
def GeneratePressed(self): self.x = self.OriginalPosition[0] - ( (self.FocusSize[0] - self.NormalSize[0]) / 2) self.y = self.OriginalPosition[1] - ( (self.FocusSize[1] - self.NormalSize[1]) / 2) Surface = pygame.surface.Surface(self.FocusSize) if not self.Gradient: Surface.fill(self.Background) else: Gradient.FillGradient(Surface, self.Background[0], self.Background[1]) Surface = add_border.add_border(Surface, (0, 0, 0), 4, 4, 4, 4) Text = self.UbuntuBoldB.render(self.Title, 0, (0, 0, 0)) TextPosition = Clasic.GetCenterPosition(Surface, Text) Surface.blit(Text, TextPosition) self.UpdateSurface(Surface)