setParentWindow on Mac OSX 10.6 with Panda3D 1.7.0 - broken?


Using the following code:


class DragonViewport (ShowBase):
  def __init__ (self, window):
    ShowBase.__init__ (self)

    self.windowType = 'onscreen'

    from pandac.PandaModules import WindowProperties
    props = WindowProperties.getDefault()
    props.setParentWindow (window.GetHandle())
    props.setOrigin (0,0)
    props.setSize (window.GetSize().width, window.GetSize().height)
    self.openDefaultWindow (props=props)

class DragonApp (wx.App):
  def __init__ (self, *args, **kwargs):
    wx.App.__init__ (self, *args, **kwargs)

    self.eventLoop = wx.EventLoop ()
    wx.EventLoop.SetActive (self.eventLoop)

  def OnInit (self):
    """Creates our interface."""
    self.SetAppName ('AppName')
    self.SetClassName ('DragonClass')

    # Retrieve Panda3D's task manager
    from direct.task.TaskManagerGlobal import taskMgr
    self.taskMgr = taskMgr
    self.taskMgr.add (self.Tick, 'wxWidgets event loop')

    # Create main window
    self.frame = wx.Frame (None, -1, 'Title')
    self.frame.SetClientSize ((1024, 768))
    self.frame.Show (True)

    self.viewport = DragonViewport (self.frame)
    return True

  def OnExit (self, event):
    self.taskMgr.stop ()

  def Tick (self, task):
    while self.eventLoop.Pending ():
      self.eventLoop.Dispatch ()
    self.ProcessIdle ()

    return task.cont

  def Start (self): ()

app = DragonApp (redirect=0)

print 'Running ..'
app.Start ()

This code works pretty good on Windows. A separate window appears for a brief time and is then merged with the main wxFrame. Result is satisfying.

However, running the same code on Mac OS X results in two windows, one borderless Panda3D window and one wxWidgets window. No re-parenting is done. … macosx.png … t-win1.png … t-win2.png

This is the intended result: … indows.png

Is this a known issue?

It’s a known issue.

Hi, i got the same using ubuntu, is the any solution ?

It’s supposed to work on Ubuntu. If it doesn’t, then it must be an entirely different issue.

Thanks rdb, you’re wright once again, it looks the error in my code was to put myWxFrame.Show(True) after the openDefaultWindow
Thanks again