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

Re: [pygame] Help with pygame



Zack,
   when I took the image you sent and saved it, then took the code you
sent, changed it to load the correct filename of 'green-car.png', and
then saved that code in the same directory as the image, then your
code worked just fine on my windows box.

After that I took the car loading and took out of the game loop, so it
would just load it once, and that still worked fine.

So attached is a zip file of the exact script and image I used that
worked. If you unzip it and then run "green-car-test.py", what happens
for you? Does it work as expected or error out?


On Mon, Dec 12, 2011 at 2:45 PM, Zack Baker <zbaker1398@xxxxxxxxx> wrote:
> Just because I keep switching it around and trying different images with
> different extensions. I get the same error with all though
>
> -Zack
>
>
> On Dec 12, 2011, at 4:40 PM, Christopher Night <cosmologicon@xxxxxxxxx>
> wrote:
>
> Okay.... obvious question.... why is your code trying to load a file called
> images.BMP if this file's name is green-car.png?
>
> -Christopher
>
> On Mon, Dec 12, 2011 at 4:25 PM, Zack Baker <zbaker1398@xxxxxxxxx> wrote:
>>
>> <green-car.png>
>>
>> On Dec 11, 2011, at 9:38 PM, Sean Wolfe wrote:
>>
>> also .. the error says windows bmp but you're on osx ... maybe we have
>> a bug handling bmps in osx?
>>
>> On Sun, Dec 11, 2011 at 11:36 PM, Sean Wolfe <ether.joe@xxxxxxxxx> wrote:
>>
>> is there a reason why you're loading the image in the while loop? The
>>
>> way I'm reading the code you're loading the bmp every 100ms based on
>>
>> clock.tick(10).
>>
>>
>> How about loading the image first then running the loop.
>>
>>
>> How big is the bmp?
>>
>>
>> On Sun, Dec 11, 2011 at 9:44 PM, Brian Fisher <brian@xxxxxxxxxxxxxxxxxxx>
>> wrote:
>>
>> Zach, code looks fine - can you attach the image as well? The problem
>>
>> may lie with it.
>>
>>
>> thanks
>>
>>
>> On Sun, Dec 11, 2011 at 2:49 PM, Zack Baker <zbaker1398@xxxxxxxxx> wrote:
>>
>> Ok guys heres the code. Same error, better code.
>>
>> #!/usr/bin/env python
>>
>>
>> import pygame
>>
>> pygame.init()
>>
>>
>> #Set height and width of the screen
>>
>> size=[400,500]
>>
>> screen=pygame.display.set_mode(size)
>>
>>
>>
>> #Loop until user clicks the close button
>>
>> done=False
>>
>> clock=pygame.time.Clock()
>>
>>
>> while done==False:
>>
>>     #This limits the while loop to a max of 10 times per second
>>
>>     clock.tick(10)
>>
>>
>>     for event in pygame.event.get():
>>
>>         if event.type==pygame.QUIT:
>>
>>             done=True
>>
>>     car=pygame.image.load('images.BMP')
>>
>>     screen.blit(car, (50, 100))
>>
>>     pygame.display.flip()
>>
>>
>>
>> pygame.quit()
>>
>>
>>
>>
>>
>>
>>
>>
>> pygame.quit()
>>
>>
>>
>>
>>
>> --
>>
>> A musician must make music, an artist must paint, a poet must write,
>>
>> if he is to be ultimately at peace with himself.
>>
>> - Abraham Maslow
>>
>>
>>
>>
>> --
>> A musician must make music, an artist must paint, a poet must write,
>> if he is to be ultimately at peace with himself.
>> - Abraham Maslow
>>
>>
>

Attachment: green-car.zip
Description: Zip archive