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

Re: [pygame] FreeSanBold Font and Screen Terminating Problems



hi,

that means you haven't declared the text variable.

So either comment out that line, or make a text variable :)

cu,

On Fri, Feb 29, 2008 at 11:35 AM, Unnsse Khan <untz786@xxxxxxxxx> wrote:
> Hello again,
>
>  Sorry, I'm a Python newbie, who still can't seem to get his app
>  staying long enough on the screen to display an image.
>
>  import os, sys
>
> import pygame
>  from pygame.locals import *
>
>  if not pygame.font: print 'Warning, fonts disabled'
>  if not pygame.mixer: print 'Warning, sound disabled'
>
>  screen = pygame.display.set_mode((1024,768))
>  car = pygame.image.load("/Users/untz/DevProjects/Python/
>  pygame_tutorial1/src/car.png")
>  screen.blit(car, (200,300))
>  pygame.display.flip()
>
>  def main():
>
>
>      while 1:
>          for event in pygame.event.get():
>              if event.type == QUIT:
>                  return
>          screen.blit(background, (0, 0))
>          screen.blit(text, (0, 0))
>          pygame.display.flip()
>
>  if __name__ == '__main__': main()
>
>  Problems:
>
>
>  Traceback (most recent call last):
>    File "/Users/untz/DevResources/Python/sample/src/
>  pygame_tutorial.py", line 22, in <module>
>      if __name__ == '__main__': main()
>    File "/Users/untz/DevResources/Python/sample/src/
>  pygame_tutorial.py", line 19, in main
>
>      screen.blit(text, (0, 0))
>  NameError: global name 'text' is not defined
>
>  Happy programming,
>
>  Unnsse
>
>
>
>  On Feb 27, 2008, at 9:14 PM, Ian Mallett wrote:
>
>  > while 1:
>  >   for event in pygame.event.get():
>  >   if event.type == QUIT:
>  >     return
>  >   screen.blit(background, (0, 0))
>  >   screen.blit(text, (0, 0))
>  >   pygame.display.flip()
>
>