0

My script, running on a RaspberryPi with a monitor connected, is supposed to display numbers like an old seven segment display. I downloaded a free seven segment font and imported it with

import pygame
pygame.init()
(... some other stuff going on here...)
NumberFont = pygame.font.Font("DSEG7Classic-Bold.ttf", int(screen.get_height()/1440*600*scale/100))
LetterFont = pygame.font.SysFont("Arial Black", int(screen.get_height()/1440*200*scale/100))
(...some other stuff going on here...)

which worked fine within PyCharm (Mac) and ThonnyIDE (RaspberryPi). I got a very nice look and it also adapts the size to the screens resolution. But whenever I start the script from the terminal I get this error:

OSError: unable to read font file 'DSEG7Classic-Bold.ttf'

can someone help me out? I'm just learning python and this is one of my first scripts.

I created a folder, with the script.py and the font in it. The IDE handles this fine. I created .fonts in /home/pi/ and added the font. It is also listed and can be used in the system appearance settings. I also tried to type in the absolute path of the font, which ended in the same result when starting the script in the terminal. In PyCharm and ThonnyIDE it always workes fine.

Lucas R H
  • 1
  • 1

0 Answers0