It looks like this is a pretty common stumbling block, and you need to call `pygame.font.init()` before the code you pasted.
Also.. the way you've pasted that code has added '||' all over the place. Not sure what's going on there (some sort of tabs/spaces thing?), but it makes it extremely hard to read! On Sat, Nov 29, 2014 at 3:31 AM, William <it.isw...@yahoo.com.dmarc.invalid> wrote: > 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 : > > http://programarcadegames.com/index.php?chapter= > introduction_to_graphics&lang=en#section_5 > > 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 > different > location than in Windows OS.And therefore python can not find it using the > SysFont > method > Can anyone give me any suggestion on how to edit the code so that I can > write text > on my graphics? > Thank you. > | > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor