Hello there,

I am using OS X Leopard, Python 2.5, and PyGame...

Wrote this sample program and what happens is that the screen appears for a brief second and terminates (closes itself) and I get this error message.

import pygame
from pygame.locals import *

def main():
        # Initialize screen
        pygame.init()
        screen = pygame.display.set_mode((400,100))
        pygame.display.set_caption('Basic Pygame program')

        # Fill background
        background = pygame.Surface(screen.get_size())
        background = background.convert()
        background.fill((250, 250, 250))

        # Display some text
        font = pygame.font.Font(None, 36)
        text = font.render("Hello Unnsse!", 1, (10, 10, 10))
        textpos = text.get_rect()
        textpos.centerx = background.get_rect().centerx

        # Blit everything to the screen
        screen.blit(background, (0, 0))
        pygame.display.flip()

        # Event loop
        while 1:
                        for event in pygame.event.get():
                                if event.type == QUIT:
                                        return
                        screen.blit(background, (0, 0))
                        pygame.display.flip()

if __name__ == '__main__': main()

This is the error message:

2008-02-27 20:23:09.627 Python[93137:613] Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.
Traceback (most recent call last)
 File "hello.py", line 33, in <module>
   if __name__ == '__main__': main()
 File "hello.py", line 16, in main
   font = pygame.font.Font(None, 36)
RuntimeError: default font not found 'freesansbold.ttf'

Subsequently, I installed freessansbold.ttf into Leopard and when I re- ran the program, nothing changed?!

How come the screen closes so fast? Also, how come it's not locating this newly installed font?

Happy programming,

Unnsse

Reply via email to