Reply
Thread Tools
cmdowns's Avatar
Posts: 100 | Thanked: 13 times | Joined on Mar 2008
#1
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's Avatar
Posts: 696 | Thanked: 1,012 times | Joined on Mar 2006 @ Asturies, Spain
#2
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.
__________________
Daniel Martín Yerga
maemo.org profile
Twitter
 

The Following User Says Thank You to yerga For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 23:17.