I’m using librocket/panda3d from the last devel version and it no longer works with librocket events.
(i’m on windows, but the error apear on linux too)
I was previously using a devel version of panda3d, without this problem.
The error:
Test
Traceback (most recent call last):
File "C:\Panda3D-1.9.0\direct\showbase\ShowBase.py", line 1856, in __igLoop
self.graphicsEngine.renderFrame()
KeyError: 'document'
:task(error): Exception occurred in PythonTask igLoop
The code generating the error:
def test():
print "Test"
librocketElem.AddEventListener(event, test) # "event" can be 'click', etc...
What can cause this ?
Why is this apearing only in the last devel version of panda ?
The problem is that libRocket expects that you only use AddEventListener with a Python method that is defined in one of the tags, and not one that is defined in your application.
This is a bug in libRocket and should be patched there.
The way I worked around it was to put this:
event = None
self = None
document = None
at the top of the module where your callback function is defined. (This is because libRocket expects these three to be defined in the global scope of the callback function, which is always the case for functions defined in tags.)
It’s hacky, but it works until someone fixes the bug in libRocket.