2017-06-04 39 views
1

我试图做一个功能在pygame的程序蟒蛇3.工作的功能基本上使得块传输的话在屏幕上简单的多线加工,使其成为一个功能,MakeWord()。它有一些参数,而不是调整使得基于正常字体大小的字体大小,字体,位置等,我想它的基础上的像素大小,所以我做了一个字体表面pygame.transfom.flip()并没有奏效。有人可以找到问题吗?pygame.transform.scale不是在字体表面

def MakeWord(Phrase, Font, Color, Pos, Size): 
    FontType = pygame.font.SysFont(Font, 400) #400 because the size will be changed anyways 
    FontSurf = FontType.render(Phrase, True, Color) 
    pygame.transform.scale(FontSurf, Size) #Does not work 
    FontRect = FontSurf.get_rect() 
    FontRect.topleft = Pos 
    Display.blit(FontSurf, FontRect) 
    return FontRect #For FontRect.collidepoint(pygame.mouse.get_pos) used later 

回答

1

pygame.transform.scale返回一个新的Surface对象。尝试将它分配到FontSurf

FontSurf = pygame.transform.scale(FontSurf, Size) 
+0

好的,谢谢,这个工程。我认为它改变了第一个表面。 – SnootierBaBoon