在调用 pygame.display.set_mode()的时候,如果是用关键字参数,会出现错误 :TypeError: set_mode() takes no keyword arguments
但是在其他的地方,用到关键字参数却没有出现错误,为什么会这样呢?
经题主查阅原因如下:
因为这是Python有些底层API直接调用的C,所以没有实现一些Python的特性,只能靠位置来判断参数,这样能最大的获得接近于C的性能
以下附上出现错误代码:
[AppleScript]
纯文本查看
复制代码
1 2 3 4 5 6 7 8 | import pygamepygame.init()screen = pygame.display.set_mode(resolution=(470, 700))while True: passpygame.quit() |
更多免费技术资料可关注:annalin1203