在调用 pygame.display.set_mode()的时候,如果是用关键字参数,会出现错误 :TypeError: set_mode() takes no keyword arguments
但是在其他的地方,用到关键字参数却没有出现错误,为什么会这样呢?
经题主查阅原因如下:
因为这是Python有些底层API直接调用的C,所以没有实现一些Python的特性,只能靠位置来判断参数,这样能最大的获得接近于C的性能
以下附上出现错误代码:
1
2
3
4
5
6
7
8
|
import pygame pygame.init ( ) screen = pygame. display .set_mode ( resolution = ( 470 , 700 ) ) while True : pass pygame. quit ( ) |
import pygame
pygame.init()
screen = pygame.display.set_mode(resolution=(470, 700))
while True:
pass
pygame.quit()
pygame中调用pygame.display.set_mode()方法参数...
原文:https://www.cnblogs.com/heimaguangzhou/p/11646793.html