ive got a sample game from college and i would like to open it a see how the game is but when i open it a blank window appears like ms dos and then closes i wonder if anyone could help out. ive installed python 2.5 and pygame.

the code starts like this:

import pygame #, pygame.mixer , sys

if __name__ == "__main__ ":
    ballimg = "c:\\ball.png"

can help out dont know what the problem is

You're likely getting an exception. When an exception is raised, the program quits.

The best way to catch the traceback is to open your own command prompt and run the program that way.

Go to Start -> Run... and enter cmd and press Enter.

This opens a windows command prompt. Now the program you're running is Python, so you'll need to type in the path to your python executable. This is likely going to be C:\PythonXX\python.exe with the XX being your python version. So for Python 2.6 it would be C:\Python26\python.exe . Now at this point you'll need a space and then the path to your python script that you're trying to run. The easiest and quickest way to do this part is to just drag and drop the icon representing your file into the command window. This will automatically insert the full path to your script.

Finally just press, Enter to have Python run your script and you should see the traceback printed to the screen. Your next step will be to debug and fix the error! Good luck! Paste your traceback here if you don't understand it and we can try to help.

dint work anyway what code should i write to open the pygame window
is it import pygame?

dint work anyway what code should i write to open the pygame window
is it import pygame?

What "dint work"?

dint work anyway what code should i write to open the pygame window
is it import pygame?

No "import pygame" you only make pygame libary available

This code to get a pygame window open.
Seek google for pygame tutorials.

#! /usr/bin/env python  
import pygame  

screen = pygame.display.set_mode((640, 400))
 
while True:
    event = pygame.event.poll()
    if event.type == pygame.QUIT:
        break
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.