[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] RLEACCEL error.
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] RLEACCEL error.
- From: Jason Massey <jason.massey@xxxxxxxxx>
- Date: Mon, 3 Oct 2005 14:50:21 -0500
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Mon, 03 Oct 2005 15:50:37 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=uGT8aWnfcJUoSQ+vyCk636et08s+cJVyb5f7FMYNlFQFlfqR5FSKo2Zphu/z51SmstTWCF7ZGVAKKsMHp5WAwkVk7NTd3ACD3weZ3WPhg0Zq11zQpFrmdE4a1oyL9aGlxqoqG2CLLL3ljCuMRdYQU2srKcycv/1aiqD4CVOmsq0=
- In-reply-to: <dhrvin$aqo$1@sea.gmane.org>
- References: <dhrvin$aqo$1@sea.gmane.org>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Just off the top of my head it looks like you need either:
1) replace the plain RLEACCEL with pygame.RLEACCEL
or, even better, at the top after import pygame
from pygame.locals import *
On 10/3/05, Jason <jason@xxxxxxxxxxxxxxxxx> wrote:
> Hi,
>
> Been playing about and trying ot get my first PyGame routine sorted.
> I've hit some hurdles, manged to scramble my way over them but this one
> has got me totally stumped!
>
> When I run my program I'm getting the following error...
>
> NameError: global name 'RLEACCEL' is not defined
>
> I can't seem to see any reference to this anywhere, my code is...
>
> import os,sys
> import pygame
> import random
>
> def load_image(name, colorkey=None):
> fullname = os.path.join('', name)
> try:
> image = pygame.image.load(fullname)
> except pygame.error, message:
> print 'Cannot load image:', name
> raise SystemExit, message
> image = image.convert()
> if colorkey is not None:
> if colorkey is -1:
> colorkey = image.get_at((0,0))
> image.set_colorkey(colorkey, RLEACCEL)
> return image, image.get_rect()
>
>
> class block(pygame.sprite.Sprite):
> blockImage=None
>
> def __init__(self):
> pygame.sprite.Sprite.__init__(self)
>
> if block.blockImage is None:
> block.image, block.rect=load_image("block2.jpg",-1)
>
> def update(self):
> self.rect.move(1,1)
>
>
> def main():
> pygame.init()
> screen=pygame.display.set_mode((640,480))
> background=pygame.Surface(screen.get_size()).convert_alpha()
>
> a=block()
> allsprites=pygame.sprite.RenderPlain((block))
>
>
>
> while True:
> allsprites.update()
> screen.blit(background,(0,0))
> allsprites.draw(screen)
> pygame.display.flip()
>
>
> if __name__=="__main__":
> main()
>
>
> IF there are any other bugs in there, please don't tell me as I'm trying
> to learn from my mistakes, but the RLEACCEL has had me baffled for hours
> now.
>
> TIA
>
>