Python Pygame错误:无法创建DIB节

Python Pygame错误:无法创建DIB节,python,pygame,dib,Python,Pygame,Dib,我刚刚从pygame网站的下载页面下载了pygame python模块,我选择了名为pygame-1.9.1.win32-py2.7.msi的软件包。当我试图执行一个程序时,出现了以下错误: Traceback (most recent call last): File "C:\Users\kkkkllkk53\The Mish Mash Files\langtons ant.py", line 16, in <module> windowSurface = pygame

我刚刚从pygame网站的下载页面下载了pygame python模块,我选择了名为pygame-1.9.1.win32-py2.7.msi的软件包。当我试图执行一个程序时,出现了以下错误:

Traceback (most recent call last):
  File "C:\Users\kkkkllkk53\The Mish Mash Files\langtons ant.py", line 16, in <module>
    windowSurface = pygame.display.set_mode((window_length, window_length), 0, 32)
error: Couldn't create DIB section

您试图创建的显示太大:

cell_length = 10
num_cells_per_side = 10000

window_length = cell_length * num_cells_per_side
windowSurface = pygame.display.set_mode((window_length, window_length), 0, 32)
等于:100001000000

试试像800x600这样的东西

如果你需要一个更大的世界,你可以尝试创建一个更大的表面而不是显示,然后只在屏幕上显示你需要的东西

cell_length = 10
num_cells_per_side = 10000

window_length = cell_length * num_cells_per_side
windowSurface = pygame.display.set_mode((window_length, window_length), 0, 32)