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

Re: [pygame] [PYGAME] Noob Help.



On Thu, Apr 12, 2007 at 11:05:34PM -0400, python@xxxxxxxxxxxx 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