I have a method that converts a "pygame.Font" class to a "pygame.Surface" surface with the method already predefined by pygame in the "pygame.Font" class: .render (). The problem is that sometimes, without apparent sense, the program remains frozen and after a few seconds, the pygame tab closes and the python program ends. The code with which I do this is as follows:
self.font = pygame.font.Font(self.fontString, self.size)
. .
def createRenderizable(self):
self.textSurface = self.font.render(self.text, self.antialias, self.color, self.backgroundColor)
All this within a class.
I can not put an error because it does not give me any, only the program closes after a few seconds.
I think it may be because of some of the pygame threads, but I'm not sure and I do not know how to fix it.
Pos if it's useful, the official pygame page where the .render () method comes in and the Font class: link