I’m on Mac osx 10.5.8
My panda3d.core.PandaSystem.getVersionString() is 1.7.0
I have a window made with ShowBase.openWindow()
This window is stored as a property of my wrapper, which is a subclass of DirectObject.
Thus I have:
self.win.hasPointer(0)
self.win.hasKeyboard(0)
These are both always true, regardless of the focus (which is what I want to know)
In my window wrapper;s init I have tried:
def test():
print "event"
self.accept("x",test)
self.accept("k-up",test)
self.accept("mouse1",test)
self.accept("mouse1-up",test)
base.accept("x",test)
base.accept("k-up",test)
base.accept("mouse1",test)
base.accept("mouse1-up",test)
but none of the events ever fire.
I suspected wx of eating my events, so I took out everything wx related, and it does not seem to help.
I suspected closing my ShowBase main window might be an issue, so I tried leaving it open. Then I tried both at once. No difference.
The one thing that does cause these events to work (but still has no effect on self.win.hasPointer(0) and self.win.hasKeyboard(0) always being true) is to show the ShowBase main window, and give it the focus.
So:
- How can I tell if my window has the focus,
- How can I make it accepting events actually work without showing and selecting the ShowBase main window.
- How can I just capture all of the events automatically? (so I can use my own event handling system)
Thanks!
Edit: one more detail I have discovered: when the mouse is not over the window, the mouse x and y values(see code below) don’t change as the mouse moves (though it still claims to have the pointer). Odd. It seems if I click and drag off the edge, it keeps updating the mouse position as long as I clicking initially in my window (which I can’t detect clicks in).
data=self.win.getPointer(0)
x=data.getX()
y=data.getY()