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

Re: [pygame] Help with the 3rd Lecture, first tutorial



On Wed, Oct 31, 2007 at 06:19:37PM -0700, kevin hayes wrote:
> (1) I run python by c:\Python25>Python <Enter>
> 
> Once in the interpreter, I can import the pygame modules, initialize Python,
> make a window, but when I try to set the caption it won't work. I did get it
> to work in the GUI, however.
> 
> pygame.display.set_caption('Monkey Fever')
> 
> (2) C:\Program Files\examples\data\chimp.bmp   "Is the path to the image"
> 
> When trying to load the image with:
> 
> monkey_head_file_name = os.path.join("data","chimp.bmp")
> >>> print monkey_head_file_name                             "Creating
> a relative Path"
> data\chimp.bmp
> 
> monkey_surface = pygame.image.load(monkey_head_file_name)    "From the
> tutorial...trying to load the image"
Hi,

I'd do it the other way round. Add C:\Python25 to your system path like
this:

Right-click on My Computer (on the desktop), select 'Properties' at the
bottom and then click on the 'Advanced' tab. At the bottom, click on the
'Environment Variables' button, and look at the 'System variables' list
in the bottom half. Scroll-down until you can see 'Path' in the
left-hand column and double-click on it. The 'Variable value:' field
should be high-lighted. Hit the 'End' key or use the mouse and cursor
keys and then *add* ';C:\Python25' (without the quotes). The end of mine
now looks like this:

...blah...blah;e:\programs\kdiff3;C:\Python25

If you have any 'accidents' make sure you click on the Cancel button and
try again.

When you are happy with it click the OK button and OK your way out of
the dialogs.

Note: it's a shame this isn't a Python installer option, but I can think
of at least one good reason why it isn't :-)

Close any currently running Windows Command Prompts (the environment is
setup when the shell is started) and then download the 'Open Command
Window Here' PowerToy from Microsoft on this page:

http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx

and install it. It adds a context-menu (right-click) item 'Open Command
Window Here' to the Windows Explorer (not IE).

Now, using the Windows Explorer, navigate to the 
'C:\Program Files\examples\' directory, right-click on it and select
'Open Command Window Here'. This should open a Windows Command Prompt with
the current directory set to the examples directory.

I find this invaluable, but that might just be me.

Type Python in the shell (if it doesn't work the path is not set
correctly) and Python will start.

Your problem (2) with the relative path will be fixed now, because the
files are loaded relative to the current working directory.

I don't know about problem (1).

Hope that helps,
John.