小甲鱼的铁粉 发表于 2020-8-2 17:45:45

pygame获取显示器最大分辨率

我这个为什么会报错呢

>>> import pygame
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> pygame.display.list_modes
<built-in function list_modes>
>>> pygame.display.list_modes()
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
    pygame.display.list_modes()
pygame.error: video system not initialized
>>>

zltzlt 发表于 2020-8-2 17:46:18

你要先 pygame.init() 才可以获取


>>> import pygame
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> pygame.init()
(6, 0)
>>> pygame.display.list_modes()
[(1920, 1080), (1680, 1050), (1600, 900), (1440, 900), (1400, 1050), (1366, 768), (1360, 768), (1280, 1024), (1280, 960), (1280, 800), (1280, 768), (1280, 720), (1280, 600), (1152, 864), (1024, 768), (800, 600), (640, 480), (640, 400), (512, 384), (400, 300), (320, 240), (320, 200)]
页: [1]
查看完整版本: pygame获取显示器最大分辨率