2017-06-04 37 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