我正在尝试在python中创建一个过剩的窗口,并具有以下代码:
glutInit()
glutInitWindowSize(windowWidth, windowHeight)
glutInitWindowPosition(int(centreX - windowWidth/2), int(centreY - windowHeight/2))
glutCreateWindow("MyWindow")
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH)
glutDisplayFunc(displayFun)
glutIdleFunc(animateFun)
glutKeyboardFunc(keyboardFun)
glutPassiveMotionFunc(mouseFun)
glutReshapeFunc(reshapeFun)
initFun()
#loadTextures()
glutMainLoop()
Run Code Online (Sandbox Code Playgroud)
我在'glutCreateWindow'一行中收到错误说:
Traceback (most recent call last):
File "F:\MyProject\main.py", line 301, in <module>
glutCreateWindow("MyWindow")
File "C:\Python34\lib\site-packages\OpenGL\GLUT\special.py", line 73, in glutCreateWindow
return __glutCreateWindowWithExit(title, _exitfunc)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
Run Code Online (Sandbox Code Playgroud)
有关此函数的文档指定
int glutCreateWindow(char *name);
Run Code Online (Sandbox Code Playgroud) 我已经创建了一个窗口,glutCreateWindow并开始使用循环glutMainLoop.我想结束那个循环并关闭窗口,所以我使用glutLeaveMainLoop并glutCloseFunc销毁它.我的应用程序自动终止.
我希望应用程序在窗口被销毁后继续存在.可能吗?
根据这个链接,我可以做到,但我不知道如何.我正在使用freeglut.