Re: [pygame] Fullscreen Display

2007-12-04 Thread Ian Mallett
Hooray!  Something I can help with!
It's:
'from pygame.locals import *'
or:
'pygame.FULLSCREEN'
Of course, I was beaten to it four times...
Ian


Re: [pygame] Fullscreen Display

2007-12-04 Thread Marius Gedminas
Hi,

On Tue, Dec 04, 2007 at 08:50:53PM +, Matt Smith wrote:
> 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 
> screen = pygame.display.set_mode((xsize, ysize), FULLSCREEN, 32)
> NameError: name 'FULLSCREEN' is not defined

You need to import it, usually with

  from pygame.locals import *

near the top of your program.

> I expected the set_mode method to treat the FULLSCREEN as an argument and 
> not as a variable/ object.

That's not how Python works.

Cheers!
Marius Gedminas
-- 
If the code and the comments disagree, then both are probably wrong.
-- Norm Schryer


signature.asc
Description: Digital signature


Re: [pygame] Fullscreen Display

2007-12-04 Thread James Paige
On Tue, Dec 04, 2007 at 08:50:53PM +, 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 
> 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?
> 
> Thanks,
> 
> Matt.

Sounds like you forgot:

from pygame.locals import *

Which is now the FULLSCREEN name gets into your program's namespace.

---
James Paige


Re: [pygame] Fullscreen Display

2007-12-04 Thread Casey Duncan

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 
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


[pygame] Fullscreen Display

2007-12-04 Thread Matt Smith

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 
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?

Thanks,

Matt.