I'm trying to create a window with glut in python and have the following code:
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()
I get an error on the 'glutCreateWindow' line saying this:
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
the documentation on this function specifies
int glutCreateWindow(char *name);
                I just encountered exactly the same problem and found this blog entry:
http://codeyarns.com/2012/04/27/pyopengl-glut-ctypes-error/
Basically you need to specify that you are passing byte data rather than a string using b'Window Title'
Apart from add a b before the string:
b"MyWindow"
You can also convert the string to ascii bytes with this:
bytes("MyWindow","ascii")
For more details, you could refer to these links:
PyOpenGL GLUT ctypes error
ctypes.ArgumentError with file_reader on Python 3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With