[Tutor] Help with error in ski game

Steven D'Aprano steve at pearwood.info
Sun Nov 20 16:22:34 CET 2011


Chloe Beck wrote:

> Traceback (most recent call last):
>   File "/Users/Chloe/Documents/SKI SKI/ski ski ski", line 99, in <module>
>     skier.move(speed)
>   File "/Users/Chloe/Documents/SKI SKI/ski ski ski", line 28, in move
>     if self.rect.centerx < 20:  self.rect.centrex = 20
> AttributeError: 'pygame.Rect' object has no attribute 'centrex'

I'm not familiar with pygame, but my guesses are:

* you have used British spelling centre instead of American spelling 
center; try using centerx instead of centrex;

* if that fails, perhaps it should be spelled center.x

* if that fails, please open a Python interactive interpreter, and at 
the prompt enter:

import pygame
dir(pygame.Rect)

and show us the output.




-- 
Steven


More information about the Tutor mailing list