maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   General (https://talk.maemo.org/forumdisplay.php?f=7)
-   -   PyGame problem, can anyone help? (https://talk.maemo.org/showthread.php?t=21814)

cmdowns 2008-07-12 02:19

PyGame problem, can anyone help?
 
I've recently upgraded my n800 to Diablo. I've been working on a project using PyGame that is described in this post. Before upgrading to Diablo, I never had a problem using PyGame.

Now I am attempting to become more familiar with Python and PyGame. I'm trying to work with some of the scripts from Will McGugan's Beginning Game Development with Python and Pygame.

When I attempt to run the following script
Code:

#!/usr/bin/env python

background_image_filename = 'sushiplate.jpg'
mouse_image_filename = 'fugu.png'

import pygame
from pygame.locals import *
from sys import exit

pygame.init()

screen = pygame.display.set_mode((640, 480), 0, 32)
pygame.display.set_caption("Hello, World!")

background = pygame.image.load(background_image_filename).convert()
mouse_cursor = pygame.image.load(mouse_image_filename)

while True:
   
    for event in pygame.event.get():
        if event.type == QUIT:
            exit()
   
    screen.blit(background, (0,0))

    x, y = pygame.mouse.get_pos()
    x-= mouse_cursor.get_width() / 2
    y-= mouse_cursor.get_height() / 2
    screen.blit(mouse_cursor, (x, y))
       
    pygame.display.update()

I get the following error message
Code:

helloworld.py:6: RuntimeWarning: import cdrom: No module named cdrom

import pygame

helloworld.py:6: RuntimeWarning: import joystick: No module named joystick

import pygame

Traceback (most recent call last):

File "helloworld.py", line 12, in <module>

screen = pygame.display.set_mode((640, 480), 0, 32)

pygame.error: Maximum supported bitdepth is 16

Does anyone have a clue what the problem might be? Any help would be much appreciated. Thanks in advance for your consideration.

yerga 2008-07-12 17:10

Re: PyGame problem, can anyone help?
 
Change this line
Code:

screen = pygame.display.set_mode((640, 480), 0, 32)
for the following one:
Code:

screen = pygame.display.set_mode((640, 480), 0, 16)
The error is saying: "Maximum supported bitdepth is 16" and you are trying use 32.
But I could be wrong, and the problem be other.


All times are GMT. The time now is 22:35.

vBulletin® Version 3.8.8