def OnInit(self): #prepare and start the p3d-wx hybrid-engine mainloop self.wxevt_loop = wx.EventLoop() self.wxevt_old_loop = wx.EventLoop.GetActive() wx.EventLoop.SetActive(self.wxevt_loop) base.taskMgr.add(self._mainLoop, "MainLoopTask") #instantiate and assign the wx UI object self.win = P3dWxWindow(size=wx.Size(640, 480)) self.SetTopWindow(self.win) #show the wx window self.win.Show(True) # is essential to let make up wx window before P3D stuff self._mainLoop() #bind wx events self.win.Bind(wx.EVT_SIZE, self.onSize) self.win.Bind(wx.EVT_CLOSE, self.onClose) self.vetoActivate=False self.win.Bind(wx.EVT_ACTIVATE, self.onActivate) #open the p3d window undecorated to use in the wx frame window wp=WindowProperties().getDefault() wp.setUndecorated(True) wp.setOpen(True) wp.setParentWindow(self.win.getP3DSurface()) wp.setOrigin(0,0) wp.setForeground(True) wp.setSize(*self.win.getP3DSurfaceSize()) print ">>>opening p3dsurface" assert base.openDefaultWindow(props=wp) == True # return True
def OnInit(self): #prepare and start the p3d-wx hybrid-engine mainloop self.wxevt_loop = wx.EventLoop() self.wxevt_old_loop = wx.EventLoop.GetActive() wx.EventLoop.SetActive(self.wxevt_loop) base.taskMgr.add(self._mainLoop, "MainLoopTask") #instantiate and assign the wx UI object self.win = P3dWxWindow(size=wx.Size(640, 480)) self.SetTopWindow(self.win) #show the wx window self.win.Show(True) # is essential to let make up wx window before P3D stuff self._mainLoop() #bind wx events self.win.Bind(wx.EVT_SIZE, self.onSize) self.win.Bind(wx.EVT_CLOSE, self.onClose) self.vetoActivate = False self.win.Bind(wx.EVT_ACTIVATE, self.onActivate) #open the p3d window undecorated to use in the wx frame window wp = WindowProperties().getDefault() wp.setUndecorated(True) wp.setOpen(True) wp.setParentWindow(self.win.getP3DSurface()) wp.setOrigin(0, 0) wp.setForeground(True) wp.setSize(*self.win.getP3DSurfaceSize()) print ">>>opening p3dsurface" assert base.openDefaultWindow(props=wp) == True # return True