Python glutCreateWindow错误'错误类型'

 mobiledu2502884843 发布于 2022-12-09 21:33

我正在尝试在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()

我在'glutCreateWindow'一行中收到错误说:

Traceback (most recent call last):
  File "F:\MyProject\main.py", line 301, in 
    glutCreateWindow("MyWindow")
  File "C:\Python34\lib\site-packages\OpenGL\GLUT\special.py", line 73, in glutCreateWindow
    return __glutCreateWindowWithExit(title, _exitfunc)
ctypes.ArgumentError: argument 1: : wrong type

有关此函数的文档指定

int glutCreateWindow(char *name);

小智.. 18

我刚遇到完全相同的问题,发现此博客条目:

http://codeyarns.com/2012/04/27/pyopengl-glut-ctypes-error/

基本上,您需要指定传递字节数据而不是使用字符串 b'Window Title'

1 个回答
  • 我刚遇到完全相同的问题,发现此博客条目:

    http://codeyarns.com/2012/04/27/pyopengl-glut-ctypes-error/

    基本上,您需要指定传递字节数据而不是使用字符串 b'Window Title'

    2022-12-11 02:02 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有