【发布时间】:2019-08-31 20:40:06
【问题描述】:
我找不到 pygame.init() 函数。请看看我做了什么。
ckim@chan-ubuntu:~$ python
Python 2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> print (pygame.__file__)
/usr/local/lib/python2.7/dist-packages/pygame/__init__.pyc
>>> pygame.init()
(6, 0)
所以我在 /usr/local/lib/python2.7/dist-packages/pygame 下搜索,但找不到模块 pygame 的 init() 源代码。在那里我找到了包含 init 的 base.so 文件(使用 nm base.so 检查)。那么pygame是不是安装了所有的源代码,一些用C或C++实现并由.so文件提供的函数和类型?
【问题讨论】:
-
PyGame 是用 C 编写的 SDL 1.2 (Simple DirectMedia Layer) 的包装器。您可以查看 C 源代码。