Is it possible: pygame.font module?

Hello,

I was wondering if it is possible to use the font module of the pygame library. My current code doesn’t work:

import pygame.font

pygame.font.init()
font = pygame.font.SysFont("System", 30)
font.render("TextHere",True,(0,0,0))
  • AniCator

AniCator,

last row in your script renders text to surface, but you don’t use returned surface. Problem is, how to render surface to framebuffer?

I think only option in GameBlender is to load rendered text to texture. GameBlender Texture Plug-in has class ImageBuff that allows to load image buffer into texture, but pygame.Surface isn’t able to export to buffer.

I suggest you to use PIL instead of pygame - its Image class is able to export image to buffer and Font class renders text to image. Then can be rendered text loaded as texture into GameBlender.