Non*_*one 5 python pygame monitor fullscreen
我正在使用python并想要创建一个全屏窗口.我知道pygame.FULLSCREEN标志,但是当我使用它时,屏幕周围会出现黑色区域.有没有办法使用python获取显示器大小,所以我可以使窗口正确的大小?
根据文档,pygame.display.Info
为您提供一个VideoInfo
具有以下属性的对象:
current_w
,current_h
:当前视频模式的宽度和高度,或者在调用display.set_mode之前调用的桌面模式的宽度和高度.
pygame.display.list_modes
为您提供可用的全屏分辨率列表,例如,根据文档中的评论:
>>> pygame.display.list_modes()
[(1920, 1080), (1768, 992), (1680, 1050), (1600, 1200), (1600, 1024), (1600, 900
), (1440, 900), (1400, 1050), (1360, 768), (1280, 1024), (1280, 960), (1280, 800
), (1280, 768), (1280, 720), (1152, 864), (1024, 768), (800, 600), (720, 576), (
720, 480), (640, 480)]
Run Code Online (Sandbox Code Playgroud)
从大到小.你应该尝试一些这些可能性,pygame.display.set_mode
看看哪一个看起来对你有好处.
归档时间: |
|
查看次数: |
8322 次 |
最近记录: |