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

Re: [pygame] Pygame trouble on the Mac



Hi James,
 that code listing you posted works just fine for me on OS X 10.5. I think I can help you if we can figure out what is different about your setup than mine that is causing the program not to work.

I had to use different images than you cause I don't know where I'm supposed to get the two used in the program - Is there some place I can get the images you are using?

In terms of my system config, I'm on an Intel mac mini running Mac OS X 10.5.6, with framework builds of python installed (I tested with 2.5 and 2.6) with development builds (pre-release 1.9.1) of pygame. The version of pygame I'm using uses SDL 1.2.13. The script works fine for me from both from the terminal and running from pydev in the eclipse editor.

So how did you install pygame?  How are you running the script?

..also, If you could post to the list what is output if you run a script with the lines below, it will let people know what versions of things you are running, and what kind of mac machine you have:
-----------------------------------

#!/usr/bin/env python
import sys
import platform
import pygame

print pygame.__version__
print pygame.base.get_sdl_version()
print sys.version
print sys.path
print platform.platform()


On Sun, Mar 8, 2009 at 12:22 PM, James Morris <james.morris1984@xxxxxxxxxxxxxx> wrote:
It's this one:

Listing3-1. Hello World Redux (helloworld.py)  (page 45)

#!/usr/bin/env python
background_image_filename = 'sushiplate.jpg'
mouse_image_filename = 'fugu.png'
import pygame
from pygame.locals import *
from sys import exit
pygame.init()
screen = pygame.display.set_mode((640, 480), 0, 32)
pygame.display.set_caption("Hello, World!")
background = ""> mouse_cursor = pygame.image.load(mouse_image_filename).convert_alpha()
while True:
   for event in pygame.event.get():
       if event.type == QUIT:
           exit()
   screen.blit(background, (0,0))
   x, y = pygame.mouse.get_pos()
   x-= mouse_cursor.get_width() / 2
   y-= mouse_cursor.get_height() / 2
   screen.blit(mouse_cursor, (x, y))
   pygame.display.update()



<--- THING IS, i just dont understand why some examples work in Pygame
and others doesn't. I've spoke to the author of the book too, and he
directed me to this mailing group. So I hope someone can help! ...
It's annoying that I have the book, but can't run the examples. I have
Python 2.5 on my Mac OSX 10.5 machine. ? The error that was generated
in the Python console didn't have a line number. Just exactly what I
posted... Maybe its just a warning? Either way the program doesn't run
correctly.

Cheers!!




2009/3/8 Ian Mallett <geometrian@xxxxxxxxx>:
- Show quoted text -
> I have the book too.  Which example are you running?  It should also give a
> line number.
>