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

Re: [pygame] pygame.error: Cannot set 0 sized display mode



hey Pete,

It might be a change for with a different version of Pygame. I never thought that passing (0, 0) for the resolution would work. I suppose before it was using a default resolution for you. (Though the fullscreen mode stretches the display sometimes, if you give it a small resolution. I'm not sure about the specific details though.) I'd go ahead and just pass (1280, 1024), since I think it is idea to pass an actual resolution.

Alternatively, after executing import pygame and pygame.init(), you can check the value in pygame.display.Info().current_w and pygame.display.Info().current_h for the current screen resolution, and then pass these values to set_display(). Then the program will run at the current resolution no matter what computer it is run on.

-Al

On Sun, Oct 14, 2012 at 1:51 AM, Peter Chant <pete@xxxxxxxxxxxxxxx> wrote:
Hello,

I have a python application that I have written with pygame that used to work
fine.  However, on upgrading to slackware 14 I get the following error:

pygame.error: Cannot set 0 sized display mode


Slackware uses SDL 1.2.14 - so I cannot see why I am getting that error.  The
offending line of code, which used to work fine is:

    self.window = pygame.display.set_mode((0,0),pygame.FULLSCREEN)

It is fine if I pass a resolution of (1280,1024), my screen resolution.  I
note however that later in the program an object created with
pygame.display.info fails - current_w does not exist.  Any idea what is wrong,
or better still, how I may fix it?

Pete