Re: [pygame] [PYGAME] Noob Help.

2007-04-17 Thread spotter .

Eric3, IDLE, Emacs are not compilers, they are editors used to edit
the python script.
They also autoformat tabs/spaces so you dont have to worry about it.

-spot

On 4/13/07, Lamonte(Scheols/Demonic) <[EMAIL PROTECTED]> wrote:

I already go a compiler now.



On 4/13/07, Lenard Lindstrom <[EMAIL PROTECTED]> wrote:
> Samuel Mankins wrote:
> > Personally, I recommend Emacs. I'm pretty sure it has a windows port
> Yes it does, XEmacs in particular.
>
> > (I know it has a Mac one) and it "understands" python code, and so it
> > will indent a little farther the line after something ending in a
> > colon. Very useful. And when you are deleting indentations, it will
> > tell you what the last thing with the amount of indentation you have
> > at the moment was.
> >
>
> --
> Lenard Lindstrom
> <[EMAIL PROTECTED]>
>
>
>



--
Join phpdiscovery.com Now!


Re: [pygame] [PYGAME] Noob Help.

2007-04-13 Thread Lamonte(Scheols/Demonic)

I already go a compiler now.

On 4/13/07, Lenard Lindstrom <[EMAIL PROTECTED]> wrote:


Samuel Mankins wrote:
> Personally, I recommend Emacs. I'm pretty sure it has a windows port
Yes it does, XEmacs in particular.

> (I know it has a Mac one) and it "understands" python code, and so it
> will indent a little farther the line after something ending in a
> colon. Very useful. And when you are deleting indentations, it will
> tell you what the last thing with the amount of indentation you have
> at the moment was.
>

--
Lenard Lindstrom
<[EMAIL PROTECTED]>






--
Join phpdiscovery.com Now!


Re: [pygame] [PYGAME] Noob Help.

2007-04-13 Thread Lenard Lindstrom

Samuel Mankins wrote:

Personally, I recommend Emacs. I'm pretty sure it has a windows port

Yes it does, XEmacs in particular.

(I know it has a Mac one) and it "understands" python code, and so it 
will indent a little farther the line after something ending in a 
colon. Very useful. And when you are deleting indentations, it will 
tell you what the last thing with the amount of indentation you have 
at the moment was.




--
Lenard Lindstrom
<[EMAIL PROTECTED]>




Re: [pygame] [PYGAME] Noob Help.

2007-04-13 Thread Samuel Mankins

Charles Christie wrote:
I recommend Eric3. I think it has a Windows port, anyway. I use it 
every day, and I find it much better than drpython.


On 4/13/07, *Kris Schnee* < [EMAIL PROTECTED] 
> wrote:


[EMAIL PROTECTED]  wrote:
> Alright so when I run the "game.py" the console says error
syntax then I
> can't read the rest because the console window closes
automatically.  I
> have the slightest idea on whats wrong.

I strongly recommend that you use an editor. Depending on exactly how
you installed Python, you should have a built-in editor called IDLE,
buried somewhere like C:\Python24\lib\idlelib. (Python really
ought to
make it more obvious.) If you use that you'll be able to get instant
feedback that shows exactly where errors occurred, and even jump
to the
right line of code with Alt-G. Trying to use Python without an editor
means it's hard to see what's going wrong, which is no way to work!

Since Python is an interpreted language, running your code once you've
written it requires no fanfare. In IDLE you just save and hit F5.
So you
can test the thing, curse at an error, fix it, and try again
within seconds.

Kris


Personally, I recommend Emacs. I'm pretty sure it has a windows port (I 
know it has a Mac one) and it "understands" python code, and so it will 
indent a little farther the line after something ending in a colon. Very 
useful. And when you are deleting indentations, it will tell you what 
the last thing with the amount of indentation you have at the moment was.


--Skizzaltix


Re: [pygame] [PYGAME] Noob Help.

2007-04-13 Thread Charles Christie

I recommend Eric3. I think it has a Windows port, anyway. I use it every
day, and I find it much better than drpython.

On 4/13/07, Kris Schnee <[EMAIL PROTECTED]> wrote:


[EMAIL PROTECTED] wrote:
> Alright so when I run the "game.py" the console says error syntax then I
> can't read the rest because the console window closes automatically.  I
> have the slightest idea on whats wrong.

I strongly recommend that you use an editor. Depending on exactly how
you installed Python, you should have a built-in editor called IDLE,
buried somewhere like C:\Python24\lib\idlelib. (Python really ought to
make it more obvious.) If you use that you'll be able to get instant
feedback that shows exactly where errors occurred, and even jump to the
right line of code with Alt-G. Trying to use Python without an editor
means it's hard to see what's going wrong, which is no way to work!

Since Python is an interpreted language, running your code once you've
written it requires no fanfare. In IDLE you just save and hit F5. So you
can test the thing, curse at an error, fix it, and try again within
seconds.

Kris



Re: [pygame] [PYGAME] Noob Help.

2007-04-13 Thread python
> [EMAIL PROTECTED] wrote:
>> Alright so when I run the "game.py" the console says error syntax then I
>> can't read the rest because the console window closes automatically.  I
>> have the slightest idea on whats wrong.
>
> I strongly recommend that you use an editor. Depending on exactly how
> you installed Python, you should have a built-in editor called IDLE,
> buried somewhere like C:\Python24\lib\idlelib. (Python really ought to
> make it more obvious.) If you use that you'll be able to get instant
> feedback that shows exactly where errors occurred, and even jump to the
> right line of code with Alt-G. Trying to use Python without an editor
> means it's hard to see what's going wrong, which is no way to work!
>
> Since Python is an interpreted language, running your code once you've
> written it requires no fanfare. In IDLE you just save and hit F5. So you
> can test the thing, curse at an error, fix it, and try again within
> seconds.
>
> Kris
>
I have a new editor. IDLE dont work for some reason it shuts down so I
just got "Cream" and thats that.


Re: [pygame] [PYGAME] Noob Help.

2007-04-13 Thread Kris Schnee

[EMAIL PROTECTED] wrote:

Alright so when I run the "game.py" the console says error syntax then I
can't read the rest because the console window closes automatically.  I
have the slightest idea on whats wrong.


I strongly recommend that you use an editor. Depending on exactly how 
you installed Python, you should have a built-in editor called IDLE, 
buried somewhere like C:\Python24\lib\idlelib. (Python really ought to 
make it more obvious.) If you use that you'll be able to get instant 
feedback that shows exactly where errors occurred, and even jump to the 
right line of code with Alt-G. Trying to use Python without an editor 
means it's hard to see what's going wrong, which is no way to work!


Since Python is an interpreted language, running your code once you've 
written it requires no fanfare. In IDLE you just save and hit F5. So you 
can test the thing, curse at an error, fix it, and try again within seconds.


Kris


Re: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread python
> On Fri, 13 Apr 2007, [EMAIL PROTECTED] wrote:
>> Alright I got an error saying:
>>
>> Syntax Error Line 6:
>> pygame.init()
>>
>>
>> Script:
>>
>> import sys
>> import pygame
>> from pygame.locals import *
>>
>>
>>  pygame.init()
>
> Indeed this is a syntax error - the code is indented unnecessarily and
> invalidly.
>
>
> Richard
>
Yay I finally fixed it.

Code:

import sys
import pygame
from pygame.locals import *
pygame.init()

size = width, height = 320, 240
speed = [2, 2]
black = 0, 0, 0

screen = pygame.display.set_mode(size)

while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()

screen.fill(black)
pygame.display.flip()


Re: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread Richard Jones
On Fri, 13 Apr 2007, [EMAIL PROTECTED] wrote:
> Alright I got an error saying:
>
> Syntax Error Line 6:
> pygame.init()
>
>
> Script:
>
> import sys
> import pygame
> from pygame.locals import *
>
>
>   pygame.init()

Indeed this is a syntax error - the code is indented unnecessarily and 
invalidly.


Richard


Re: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread python
>> On Fri, 13 Apr 2007, [EMAIL PROTECTED] wrote:
>>> I think I know the problem, its the text pad I'm using.  I have
>>> NotePad++
>>> anyone recommend any besides Dr Python (atm I can't use it+ its a
>>> little
>>> slow on this comp).
>>
>> http://wiki.python.org/moin/PythonEditors
>>
>> (Google search "python editor windows")
>>
>>
>>Richard
>>
> Yep I just checked there thanks mate.
>
> Regards,
> Lamonte.
>
Alright I got an error saying:

Syntax Error Line 6:
pygame.init()


Script:

import sys
import pygame
from pygame.locals import *


pygame.init()

size = width, height = 320, 240
speed = [2, 2]
black = 0, 0, 0

screen = pygame.display.set_mode(size)

while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()

screen.fill(black)
pygame.display.flip()


Re: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread Ryan Charpentier

Python comes with a fair IDE called Idle. It is pretty good if you just want
to run some python code quick, but i'm not a big fan of the debugger.


Re: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread python
> On Fri, 13 Apr 2007, [EMAIL PROTECTED] wrote:
>> I think I know the problem, its the text pad I'm using.  I have
>> NotePad++
>> anyone recommend any besides Dr Python (atm I can't use it+ its a little
>> slow on this comp).
>
> http://wiki.python.org/moin/PythonEditors
>
> (Google search "python editor windows")
>
>
>Richard
>
Yep I just checked there thanks mate.

Regards,
Lamonte.


Re: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread Richard Jones
On Fri, 13 Apr 2007, [EMAIL PROTECTED] wrote:
> I think I know the problem, its the text pad I'm using.  I have NotePad++
> anyone recommend any besides Dr Python (atm I can't use it+ its a little
> slow on this comp).

http://wiki.python.org/moin/PythonEditors

(Google search "python editor windows")


   Richard


Re: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread python
> On Fri, 13 Apr 2007, [EMAIL PROTECTED] wrote:
>> It says invalid syntax then a carrt(^) points up to "try:"
>
> If your source is indented in the same manner as the mail you're posting
> then
> you've got syntax errors due to the indentation of your source.
>
> Have you run through the python tutorial? If not then I'd recommend it. It
> doesn't take long, and you'll most likely end up quite enlightened.
>
> http://docs.python.org/tut/tut.html
>
>
> Richard
>
I think I know the problem, its the text pad I'm using.  I have NotePad++
anyone recommend any besides Dr Python (atm I can't use it+ its a little
slow on this comp).

Heres how its indented :( : http://www.uni-code.com/codebox/D_GAME.py


Re: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread Richard Jones
On Fri, 13 Apr 2007, [EMAIL PROTECTED] wrote:
> It says invalid syntax then a carrt(^) points up to "try:"

If your source is indented in the same manner as the mail you're posting then 
you've got syntax errors due to the indentation of your source.

Have you run through the python tutorial? If not then I'd recommend it. It 
doesn't take long, and you'll most likely end up quite enlightened.

http://docs.python.org/tut/tut.html


Richard


Re: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread python
> On Thu, Apr 12, 2007 at 11:05:34PM -0400, [EMAIL PROTECTED] wrote:
>> >>
>> >> But it doesn't work.
>> >>
>> >
>> > Never say these words as your only explanation when you post code.
>> >
>> > Say "But when I try running it, I get an error message that says
>> > blahblahblah and I don't understand what that means"
>> >
>> > or "But when I try to run it (detailed description) happens"
>> >
>> > or "but when I try to run it absolutely nothing happens. How do i et
>> > more information about what went wrong?"
>> >
>> Alright I tried fixing the error so I typed this in notepad:
>>
>> import sys, pygame
>>
>> pygame.init()
>> size = width, height = 320, 240
>> speed = [2, 2]
>> black = 0, 0, 0
>>
>> screen = pygame.display.set_mode(size)
>>
>> while 1:
>> for event in pygame.event.get():
>> if event.type == pygame.QUIT: sys.exit()
>>
>> screen.fill(black)
>> pygame.display.flip()
>>
>> Alright so when I run the "game.py" the console says error syntax then I
>> can't read the rest because the console window closes automatically.  I
>> have the slightest idea on whats wrong.
>>
>
> Ah! Now we are getting somewhere! :)
>
> That closing console window is a real pain, isn't it?
>
> I would reccomend a couple possible options to make your error message
> readable.
>
> 1) If you are comfortable with the CMD prompt, use it. You can change
> into the directory where your python file is, and run
>
>   python game.py
>
> and any error messages will be readable because the console doesn't
> close when you run that way.
>
> 2) Make a little batch file called TEST.BAT with two lines in it like
>
>   python game.py
>   pause
>
> and then run that to test your game. the "pause" batch command will make
> the console window wait for a keypress before it vanishes
>
> 3) Get a python editor. I like DrPython from
> http://drpython.sf.net/ and I have heard lots of good things about
> eclipse+pydev. I'm sure that others on this list can suggest other
> editors.
>
> ---
> James Paige
>
Something has to be wrong with my python because evertything I try throws
errors. For instance:

try:
import sys
except:
print "Couldn't import sys.\n";

try:
import pygame
except:
print "couldn't import pygame\n";


pygame.init()
size = width, height = 320, 240
speed = [2, 2]
black = 0, 0, 0

screen = pygame.display.set_mode(size)

while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()

screen.fill(black)
pygame.display.flip()

It says invalid syntax then a carrt(^) points up to "try:"


Does python latest version work with pygame?(is there a later version of
python released/where can I download it at?


Re: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread James Paige
On Thu, Apr 12, 2007 at 11:05:34PM -0400, [EMAIL PROTECTED] wrote:
> >>
> >> But it doesn't work.
> >>
> >
> > Never say these words as your only explanation when you post code.
> >
> > Say "But when I try running it, I get an error message that says
> > blahblahblah and I don't understand what that means"
> >
> > or "But when I try to run it (detailed description) happens"
> >
> > or "but when I try to run it absolutely nothing happens. How do i et
> > more information about what went wrong?"
> >
> Alright I tried fixing the error so I typed this in notepad:
> 
> import sys, pygame
> 
> pygame.init()
> size = width, height = 320, 240
> speed = [2, 2]
> black = 0, 0, 0
> 
> screen = pygame.display.set_mode(size)
> 
> while 1:
> for event in pygame.event.get():
> if event.type == pygame.QUIT: sys.exit()
> 
> screen.fill(black)
> pygame.display.flip()
> 
> Alright so when I run the "game.py" the console says error syntax then I
> can't read the rest because the console window closes automatically.  I
> have the slightest idea on whats wrong.
> 

Ah! Now we are getting somewhere! :)

That closing console window is a real pain, isn't it?

I would reccomend a couple possible options to make your error message 
readable.

1) If you are comfortable with the CMD prompt, use it. You can change 
into the directory where your python file is, and run

  python game.py

and any error messages will be readable because the console doesn't 
close when you run that way.

2) Make a little batch file called TEST.BAT with two lines in it like

  python game.py
  pause

and then run that to test your game. the "pause" batch command will make 
the console window wait for a keypress before it vanishes

3) Get a python editor. I like DrPython from 
http://drpython.sf.net/ and I have heard lots of good things about 
eclipse+pydev. I'm sure that others on this list can suggest other 
editors.

---
James Paige


RE: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread paris
Hi,

I can't run the code at the moment - on a machine w/o pygame but... 
launch a cmd window and run the program from there.
e.g. start->run->cmd
that way the window will stay open and you can see the error.

Best,
p



>  Original Message ----
> Subject: Re: [pygame] [PYGAME] Noob Help.
> From: [EMAIL PROTECTED]
> Date: Thu, April 12, 2007 11:05 pm
> To: [EMAIL PROTECTED]
> 
> >>
> >> But it doesn't work.
> >>
> >
> > Never say these words as your only explanation when you post code.
> >
> > Say "But when I try running it, I get an error message that says
> > blahblahblah and I don't understand what that means"
> >
> > or "But when I try to run it (detailed description) happens"
> >
> > or "but when I try to run it absolutely nothing happens. How do i et
> > more information about what went wrong?"
> >
> Alright I tried fixing the error so I typed this in notepad:
> 
> import sys, pygame
> 
> pygame.init()
> size = width, height = 320, 240
> speed = [2, 2]
> black = 0, 0, 0
> 
> screen = pygame.display.set_mode(size)
> 
> while 1:
> for event in pygame.event.get():
> if event.type == pygame.QUIT: sys.exit()
> 
> screen.fill(black)
> pygame.display.flip()
> 
> Alright so when I run the "game.py" the console says error syntax then I
> can't read the rest because the console window closes automatically.  I
> have the slightest idea on whats wrong.



Re: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread python
>>
>> But it doesn't work.
>>
>
> Never say these words as your only explanation when you post code.
>
> Say "But when I try running it, I get an error message that says
> blahblahblah and I don't understand what that means"
>
> or "But when I try to run it (detailed description) happens"
>
> or "but when I try to run it absolutely nothing happens. How do i et
> more information about what went wrong?"
>
Alright I tried fixing the error so I typed this in notepad:

import sys, pygame

pygame.init()
size = width, height = 320, 240
speed = [2, 2]
black = 0, 0, 0

screen = pygame.display.set_mode(size)

while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()

screen.fill(black)
pygame.display.flip()

Alright so when I run the "game.py" the console says error syntax then I
can't read the rest because the console window closes automatically.  I
have the slightest idea on whats wrong.


Re: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread python
> On Fri, 13 Apr 2007, [EMAIL PROTECTED] wrote:
>> Alright how do you open a blank window. I tried the following:
>>  import pygame as D_ENGINE
>>
>> size = width, height = 320, 240
>> speed = [2, 2]
>> black = 0, 0, 0
>>
>> screen = D_ENGINE.display.set_mode(size)
>>
>> while 1:
>> for event in D_ENGINE.event.get():
>> if event.type == D_ENGINE.QUIT: sys.exit()
>>
>> screen.fill(black)
>> screen.blit(ball, ballrect)
>> D_ENGINE.display.flip()
>>
>>
>> But it doesn't work.
>
> Please always supply a traceback of the error you receive when asking for
> help. "It doesn't work" is rarely helpful.
>
> First problems from glancing at the code:
>
> 1. you're referring to "ball" and "ballrect" when they don't exist.
> 2. you also use the sys module without importing it.
>
> Also, why are you renaming pygame?
>
>
> Richard
>
Im sorry, im noob @ this.  Ill try what you said and Im just testing junk
getting used to pygame and python etc.. nothing big.


Re: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread Richard Jones
On Fri, 13 Apr 2007, [EMAIL PROTECTED] wrote:
> Alright how do you open a blank window. I tried the following:
>   import pygame as D_ENGINE
>
> size = width, height = 320, 240
> speed = [2, 2]
> black = 0, 0, 0
>
> screen = D_ENGINE.display.set_mode(size)
>
> while 1:
> for event in D_ENGINE.event.get():
> if event.type == D_ENGINE.QUIT: sys.exit()
>
> screen.fill(black)
> screen.blit(ball, ballrect)
> D_ENGINE.display.flip()
>
>
> But it doesn't work.

Please always supply a traceback of the error you receive when asking for 
help. "It doesn't work" is rarely helpful.

First problems from glancing at the code:

1. you're referring to "ball" and "ballrect" when they don't exist.
2. you also use the sys module without importing it.

Also, why are you renaming pygame?


Richard


Re: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread Bob the Hamster
> 
> But it doesn't work.
> 

Never say these words as your only explanation when you post code.

Say "But when I try running it, I get an error message that says 
blahblahblah and I don't understand what that means"

or "But when I try to run it (detailed description) happens"

or "but when I try to run it absolutely nothing happens. How do i et 
more information about what went wrong?"


Re: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread python
> On Thu, Apr 12, 2007 at 08:38:28PM -0500, Lamonte(Scheols/Demonic) wrote:
>>Ok I'm just trying to get un-noob with pygame and python it self.
>>
>>Alright I was reading on a tutorial from the pygame site located
>> here:
>>http://www.pygame.org/docs/tut/intro/intro.html
>>So I'm trying to find out whats up with this:
>>14for event in pygame.event.get():
>>15if event.type == pygame.QUIT: sys.exit()
>>
>>So i've looked @ the python document for the for loop and im just
>> trying
>>to figure out the event.get() array can someone tell me how we got
>>event.type and how does pygame.QUIT : sys.exit() work?
>>
>>Thanks in advanced for the help.
>>
>>Regards,
>>
>>Lamonte Harris.
>
> pygame.event.get() is not an array. it is an iterator. Yes, the "for"
> command can be used to loop through arrays, but it is also used with
> iterators. Since arrays are the concept you are familiar with, think of
> an iterator as a special kind of array that can only be read in
> order from beginning to end.
>
>
> Anyway, here is what that block of code does.
>
>>14for event in pygame.event.get():
>
> the "for" line iterates through all the available events. This includes
> keypresses, mouse clicks, and other stuff too. But for now, what you
> probably care about most is the keypresses.
>
> Every time you press a key, a key event is generated. When your "event
> loop" runs, it loops through all the new events.
>
>>15if event.type == pygame.QUIT: sys.exit()
>
> Now, inside the loop, the "event" variable holds information about the
> event. event.type is the kind of event. besides pygame.QUIT you may see
> things like pygame.KEYDOWN or pygame.KEYUP
>
> If the event is keyboard related, you will also have access to
> event.key which tells you which key the event represents. In my own
> code, I like to do something like this, so that both clicking the "X" in
> the top right corner and pressing ESC will both exit the program:
>
>   for event in pygame.event.get():
>   if event.type == pygame.QUIT: sys.exit()
>   if event.type == pygame.KEYDOWN:
>   if event.key == pygame.ESC: sys.exit()
>
> ---
> James Paige
>
Alright how do you open a blank window. I tried the following:


import pygame as D_ENGINE

size = width, height = 320, 240
speed = [2, 2]
black = 0, 0, 0

screen = D_ENGINE.display.set_mode(size)

while 1:
for event in D_ENGINE.event.get():
if event.type == D_ENGINE.QUIT: sys.exit()

screen.fill(black)
screen.blit(ball, ballrect)
D_ENGINE.display.flip()


But it doesn't work.

Regards,
Lamonte Harris.


Re: [pygame] [PYGAME] Noob Help.

2007-04-12 Thread James Paige
On Thu, Apr 12, 2007 at 08:38:28PM -0500, Lamonte(Scheols/Demonic) wrote:
>Ok I'm just trying to get un-noob with pygame and python it self.
> 
>Alright I was reading on a tutorial from the pygame site located here:
>http://www.pygame.org/docs/tut/intro/intro.html
>So I'm trying to find out whats up with this:
>14for event in pygame.event.get():
>15if event.type == pygame.QUIT: sys.exit()
> 
>So i've looked @ the python document for the for loop and im just trying
>to figure out the event.get() array can someone tell me how we got
>event.type and how does pygame.QUIT : sys.exit() work?
> 
>Thanks in advanced for the help.
> 
>Regards,
> 
>Lamonte Harris.

pygame.event.get() is not an array. it is an iterator. Yes, the "for" 
command can be used to loop through arrays, but it is also used with 
iterators. Since arrays are the concept you are familiar with, think of 
an iterator as a special kind of array that can only be read in 
order from beginning to end.


Anyway, here is what that block of code does.

>14for event in pygame.event.get():

the "for" line iterates through all the available events. This includes 
keypresses, mouse clicks, and other stuff too. But for now, what you 
probably care about most is the keypresses.

Every time you press a key, a key event is generated. When your "event 
loop" runs, it loops through all the new events.

>15if event.type == pygame.QUIT: sys.exit()

Now, inside the loop, the "event" variable holds information about the 
event. event.type is the kind of event. besides pygame.QUIT you may see 
things like pygame.KEYDOWN or pygame.KEYUP

If the event is keyboard related, you will also have access to 
event.key which tells you which key the event represents. In my own 
code, I like to do something like this, so that both clicking the "X" in 
the top right corner and pressing ESC will both exit the program:
 
  for event in pygame.event.get():
  if event.type == pygame.QUIT: sys.exit()
  if event.type == pygame.KEYDOWN:
  if event.key == pygame.ESC: sys.exit()

---
James Paige