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

Re: [pygame] Pygame trouble on the Mac

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
screen = pygame.display.set_mode((640, 480), 0, 32)
pygame.display.set_caption("Hello, World!")
background = pygame.image.load(background_image_filename).convert()
mouse_cursor = pygame.image.load(mouse_image_filename).convert_alpha()
while True:
    for event in pygame.event.get():
        if event.type == QUIT:
    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))

<--- 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


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