[Tutor] (no subject)

William it.iswill at yahoo.com
Sat Nov 29 10:31:57 CET 2014

Hello there I'm using Python  3.4 running on Ubuntu 14.04LTS
I'm new to programming and also new to linux
I'm trying to learn the pygame library
I was reading :


On the section on how to draw text the writer has the following code
font ||=||pygame.font.SysFont(||'Calibri'||, ||25||, ||True||, ||False||)|
|text ||=||font.render(||"My text"||,||True||,BLACK)
||screen.blit(text, [||250||, ||250||])

When I run the code using the IDLE the Python shell gives me the 
following error

Traceback (most recent call last):
File "/home/william/Desktop/Pygame/Python 3X/Drawing_Shapes.py", line 
48, in <module>
font = pygame.font.SysFont('Calibri', 25, True, False)
File "/usr/local/lib/python3.4/dist-packages/pygame/sysfont.py", line 
614, in SysFont
return constructor(fontname, size, set_bold, set_italic)
File "/usr/local/lib/python3.4/dist-packages/pygame/sysfont.py", line 
537, in font_constructor
font = pygame.font.Font(fontpath, size)
pygame.error: font not initialized

I think the problem is that the fonts in Ubuntu are probably stored in a 
location than in Windows OS.And therefore python can not find it using 
the SysFont
Can anyone give me any suggestion on how to edit the code so that I can 
write text
on my graphics?
Thank you.

More information about the Tutor mailing list