Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from = 0
File "<stdin>", line 1
from = 0
^
SyntaxError: invalid syntax
>>>
from . import что_то_там # Yes I No 1 Locale nado ispolzovat
from что_то_там import что_то_там
_from = 0 # Yes
from_ = True # Yes
from_True = True # Yes
cdef extern from "glut.h":
void glutInitDisplayMode(int mode);
void glutInitWindowPosition(int x, int y);
void glutInitWindowSize(int width, int height);
int glutCreateWindow(char *title);
void glutDisplayFunc(void (*functionName)(void)); # С этой функцией проблемы
void glutMainLoop();
def PythonGlutInitDisplayMode(mode):
glutInitDisplayMode(mode)
def PythonGlutInitWindowPosition(x, y):
glutInitWindowPosition(x, y)
def PythonGlutInitWindowSize(width, height):
glutInitWindowSize(width, height)
def PythonGlutCreateWindow(title):
return glutCreateWindow(title.encode('cp1251'))
def PythonGlutDisplayFunc(functionName):
glutDisplayFunc(functionName)
def PythonGlutMainLoop():
glutMainLoop()
C:\PyScripterProjects\PyGlut2>py setup.py build_ext --inplace
Compiling pyglut.pyx because it changed.
Cythonizing pyglut.pyx
Error compiling Cython file:
------------------------------------------------------------
...
void glutInitDisplayMode(int mode);
void glutInitWindowPosition(int x, int y);
void glutInitWindowSize(int width, int height);
int glutCreateWindow(char *title);
void glutDisplayFunc(void (*functionName)(void));
^
------------------------------------------------------------
pyglut.pyx:7:46: Use spam() rather than spam(void) to declare a function with no
arguments.
Error compiling Cython file:
------------------------------------------------------------
...
def PythonGlutCreateWindow(title):
return glutCreateWindow(title.encode('cp1251'))
def PythonGlutDisplayFunc(functionName):
glutDisplayFunc(functionName)
^
------------------------------------------------------------
pyglut.pyx:25:32: Cannot convert Python object to 'void (*)(void)'
Traceback (most recent call last):
File "setup.py", line 8, in <module>
language="c++", # generate and compile C++ code
File "C:\Python36\lib\site-packages\Cython\Build\Dependencies.py", line 825, i
n cythonize
cythonize_one(*args[1:])
File "C:\Python36\lib\site-packages\Cython\Build\Dependencies.py", line 944, i
n cythonize_one
raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: pyglut.pyx
C:\PyScripterProjects\PyGlut2>
Поясните. Что вы мне пытаетесь втюхать.