[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Font not initializing?



I don't see pygame.init() or pygame.font.init() in there anywhere...

On Sat, Oct 24, 2009 at 7:57 PM, james carnell <jimcarnell@xxxxxxxxx> wrote:
I'm new, but this is giving me problems. I'm on Ubuntu 9.04. I have tried copy pasting other source codes with the same result. Should I just make my own Font class from spites?


import pygame
===============================
def test():
  screen = pygame.display.set_mode((640, 480))
  background = "">  background = "">  background.fill((0, 0, 0))

  font = pygame.font.get_default_font()
  theFont = pygame.font.SysFont(font, 40)
  msg = theFont.render("Hello World!",1,(255, 0, 255))

  screen.blit(background, (0, 0))
  screen.blit(msg, (20, 100))
  pygame.display.flip()
  done = False
  while not done:
    for event in pygame.event.get():
      if event.type == pygame.QUIT:
        done = True
================================   
test()
================================
/usr/lib/python2.6/dist-packages/pygame/sysfont.py:139: DeprecationWarning: os.popen3 is deprecated.  Use the subprocess module.
  flin, flout, flerr = os.popen3('fc-list : file family style')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "<input>", line 8, in test
  File "/usr/lib/python2.6/dist-packages/pygame/sysfont.py", line 253, in SysFont
    font = pygame.font.Font(fontname, size)
error: font not initialized