[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
SV: Re: [pygame] Problem with surfarray on windows
Wow, really quick response!
Thanks!
Best Regards
/John
--------- Ursprungligt Meddelande --------
Från: pygame-users@xxxxxxxx
Till: pygame-users@xxxxxxxx <pygame-users@xxxxxxxx>
Ämne: Re: [pygame] Problem with surfarray on windows
Datum: 2005/09/08 09:44
>
> Hey,
>
> thanks for the example :)
>
>
> Unforunately there was a bug where it locked the surface again at the
> end of the function, instead of unlocking it.
>
> Which is fixed in cvs. So the it will be fixed in the next release.
>
> For now, as a work around you can unlock it twice afterward.
> img.unlock()
> img.unlock()
>
>
> Cheers.
>
>
> On 9/8/05, John Eriksson <john@xxxxxxxxxxxx> wrote:
> > Hi,
> >
> > Here is a small example code.
> >
> > If you remove the call to array_colorkey(...) or the
set_colorkey(...) it> will draw a small rectangle in the middle of the
screen. Otherwise it fails
> > with the message:
> >
> > Traceback (most recent call last):
> > File "SurfarrayProblem.py", line 18, in ?
> > screen.blit(img, r)
> > pygame.error: Surfaces must not be locked during blit
> >
> > <code>
> > import pygame
> > from pygame.locals import *
> >
> > pygame.init()
> > screen = pygame.display.set_mode((300, 300),1)
> >
> > img = pygame.Surface([20,20])
> > img = img.convert()
> > img.set_colorkey((0xff, 0xff, 0xff), RLEACCEL)
> > img.fill((0,0,0))
> > r = img.get_rect()
> > r.centerx = 150
> > r.centery = 150
> > colorarray = pygame.surfarray.array_colorkey(img)
> > screen.fill((255,255,255))
> > screen.blit(img, r)
> > pygame.display.flip()
> >
> > running = 1
> > while running:
> > for event in pygame.event.get():
> > if event.type = QUIT:
> > running = 0
> > </code>
> >
> > >
> > > I haven't seen this bug before.
> > >
> > > Do you think you could make a little example?
> > >
> > > Then I should be able to test/debug it easier.
> > >
> > > Cheers,
> > >
> > >
> >
> >
>
>
>
>