WxPandaWindow / Mouse / Keyboard Input

Hi everyone,

I have a Panda3D window setup on a wxFrame. It looks good. However, I have been trying to figure out how to pass keyboard and mouse input to it.

The Frame:

def init(self, parent):
wx.Frame.init(self, parent, -1, ‘Test’, size=(300, 200))

    panelSizer = wx.BoxSizer(wx.VERTICAL)

    self.window1 = WxPandaWindow(parent=self)
    panelSizer.Add(self.window1, 1, wx.EXPAND)


I can draw things to it, but I assume the wxFrame is blocking the keyboard and mouse input, is there a way to pass it over? Thanks!

Ok, so I found this and finally go it working.

class MainFrame(wx.Frame):
    def __init__(self, *args, **kwargs):
        wx.Frame.__init__(self, *args, **kwargs)

        self.auiManager = wx.aui.AuiManager(self)
        self.panda = WxPandaWindow(self)
        pandaInfo = wx.aui.AuiPaneInfo().Name("panda")
        self.auiManager.AddPane(self.panda, pandaInfo)

class Map3D(ShowBase):
    def __init__(self):
        ShowBase.__init__(self, fStartDirect=False, windowType=None)

        self.wxApp.Bind(wx.EVT_CLOSE, self.quit)
        self.frame = MainFrame(None, wx.ID_ANY, 'Editor', size=(800, 600))

        # YNJH : create P3D window
        wp = core.WindowProperties()
        base.openMainWindow(type = 'onscreen', props=wp)

But the problem is, the Panda3D is no long dynamically sizable. Thanks guys.

Hi Everyone,

I have posted a freelancer job to help me with this issue. Thanks.

freelancer.ca/projects/Pyth … board.html

All fixed :slight_smile:

Hi Cytruss,

willing to share the solution?

Yes of course,

Hope it helps.

class Map3D(ShowBase):
    def __init__(self, wxPanel):
        self.wxPanel = wxPanel

        assert self.wxPanel.GetHandle() != 0
        wp = self.getwxPanelProp() 
        ShowBase.__init__(self, fStartDirect=False, windowType=None)
        base.openMainWindow(props = wp, gsg = None)
        self.wxPanel._win = base.win

        self.wxPanel.Bind(wx.EVT_SIZE, self.OnResize)

    wx_app = wx.App(0)
    frame = wx.Frame(None, wx.ID_ANY, 'Tactical Display')
    viewer = wx.Panel(frame, wx.ID_ANY)

    MAP = Map3D(viewer)

So Map3D basically gets put in a Frame. Works very well. Resizes and everything.