1

This is my code and it works, but I don't know why my previous code didn't work. there was no error showed when I tried my previously written code. if I simply changed 'SysFont' into 'Font', an error would show, saying no such file, so I copied the ttf file into the application folder and it worked just fine.

fontObj4 =pygame.font.Font("seguisym.ttf",30)
textSurfaceObj4 = fontObj4.render('Press arrow '+ u'\u2191'+'  '+u'\u2193'+ '  level now: %d'  % diff2, True,BLACK)

My previous code:

fontObj4 =pygame.font.SysFont("seguisym.ttf",30)
textSurfaceObj4 = fontObj4.render('Press arrow '+ u'\u2191'+'  '+u'\u2193'+ '  level now: %d'  % diff2, True,BLACK)
Zack_Zhang
  • 11
  • 1
  • 2
    [pygame.font.SysFont(…)](https://www.pygame.org/docs/ref/font.html#pygame.font.SysFont) will look for an installed font matching the name you've supplied, but will fall back to the default font if nothing suitable is found. It also expects a *name* argument, but you've supplied a file name. Is the `seguisym` font installed in your system, if so, removing the `.ttf` extension might work. – import random Apr 27 '21 at 04:29

0 Answers0