Hi,
I'm new to OpenGL programming, and I'm having problems creating popup menus
with glutCreateMenu() in PyOpenGL. When I call glutCreateMenu(FunctionName),
Python throws a TypeError:
File "build\bdist.win32\egg\OpenGL\GLUT\special.py", line 165, in
glutCreateMenu
result = simple.glutCreateMenu( cCallback )
ArgumentError: argument 1: <type 'exceptions.TypeError'>: expected
CFunctionType instance instead of CFunctionType
This error confuses me - I read the 'expected' part to mean "Python wanted
cheese, but instead got... cheese." I'm sorry if I'm missing something
blatantly obvious here, but can someone please help me by explaining why
Python says it wants cheese and then won't eat the cheese I give it? An
approximation of (hopefully all) the relavent code is below:
________________________________________
MenuA = 0
MenuA = 0
def InitGL():
## Initialize PyOpenGL
def InitPopupMenus():
global MenuA, MenuB ## Note that these menus should get swapped during
execution using glutSetMenu() & glutAttachMenu()
MenuA = glutCreateMenu(HandlePopupMenuClick) ## This line throws the
error
glutAddMenuEntry("Option 1", "OPTION1")
glutAddMenuEntry("Option 2", "OPTION2")
glutAddMenuEntry("Option 3", "OPTION3")
MenuB = glutCreateMenu(HandlePopupMenuClick) ## This line would throw the
error, too
glutAddMenuEntry("Option 1", "OPTION1")
glutAddMenuEntry("OPtion 4", "OPTION4")
########
## All the relavent Display, Reshape, backend functions and the like
########
def HandlePopupMenuClick(Value):
## Process popup menu selection
def Main():
##Initialize GLUT, register Display, Reshape, Idle etc. functions
InitGL()
InitPopupMenus()
glutMainLoop()
Main()
________________________________________
Thanks,
J.
|