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

Re: [pygame] very easy snippets to start: where from i can get?



thanks! is exactly like that were what i'm looking for! :-)

--------------------------



On Fri, Jul 25, 2008 at 4:51 PM, Brad Montgomery
<brad@xxxxxxxxxxxxxxxxxx> wrote:
> Ahhhh!  My eyes!!!!   :)
>
> On Fri, Jul 25, 2008 at 10:47 AM, Peter Shinners <pete@xxxxxxxxxxxx> wrote:
>> Paulo Silva wrote:
>>>
>>> for example, this code, how do it would look like with Python-Pygame?
>>>
>>> http://pastebin.com/f5642fd17
>>> (runs on sdlBasic)
>>>
>>
>> I have created the ugliest pygame code in the world to match you example. I
>> hope it provides an interest for you to actually learn a bit of Python's
>> elegence (little of which is on display here)
>>
>> -----------------------------------
>> import pygame, random
>> from random import randint as rnd
>>
>> def waitkey():
>>   while 1:
>>       e = pygame.event.wait()
>>       if e.type in (pygame.QUIT, pygame.KEYDOWN):
>>           return
>>
>>
>> finp="ring5.png";fout=finp+".bmp"
>> xed=320;yed=240
>> window=pygame.display.set_mode((xed, yed),0,32)
>> img=pygame.image.load(finp);window.blit(img,(0,0))
>> for i in range(100):
>>   color=rnd(0,255),rnd(0,255),rnd(0,255)
>>   box=rnd(0,xed),rnd(0,yed),rnd(0,xed),rnd(0,yed)
>>   window.fill(color,box)
>> pygame.display.flip()
>> pygame.image.save(window,fout)
>> waitkey()
>> -----------------------------------
>>
>>
>
>
>
> --
> brad [bradmontgomery.net]
>