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

Re: [pygame] Fullscreen Display



On Dec 4, 2007, at 12:50 PM, Matt Smith wrote:

Hi,

I have seen the following line used to initialise a full screen display in a number of books and tutorials:

screen = pygame.display.set_mode((xsize, ysize), FULLSCREEN, 32)

When I use it in my program then I get the following error:

Traceback (most recent call last):
  File "bouncing_ball_OOP.py", line 63, in <module>
    screen = pygame.display.set_mode((xsize, ysize), FULLSCREEN, 32)
NameError: name 'FULLSCREEN' is not defined

I expected the set_mode method to treat the FULLSCREEN as an argument and not as a variable/ object. I can use the following line without a problem to initialise a windowed display for my program:

screen = pygame.display.set_mode((xsize, ysize), 0, 32)

Can anyone tell me where I'm going wrong?

You need to import the name FULLSCREEN into your namespace, or prefix your reference to it with the pygame module like so:

pygame.FULLSCREEN

to import it directly, use:

from pygame.locals import *

the latter makes it a less clear where the name comes from, however with the benefit of increased brevity.

-Casey