On Apr 15, 2011, at 8:37 AM, adwelly wrote:
Well, this is quite a pickle. :( You *might* be able to do some really black magic using PyObjC to solve this issue by dynamically adding those methods to your wxPanel's underlying NSView. It would go something like this:
from AppKit import *
def addVoutSubview_(self, subview):
view.setAutoresizingMask_(NSViewHeightSizable | NSViewWidthSizable)
def removeVoutSubview_(self, subview):
Note that this is all untested pseudocode, so no guarantees. If all goes well, then after this code is run, try the set_nsobject() function again and it should work. Hooray for Objective C having some of the dynamic dispatch of languages like Python. :)
In any case, I'd file a bug in the wx trac about not being able to create a wxWindow from a native handle cross-platform. It should definitely be possible, and it would make situations like this much easier. Then you could just create an NSView subclass in PyObjC, add those methods to it, and do wx.Window(myNSView) or some such to create the wx.Window. Resorting to black magic like this (which actually adds those methods to *all* NSViews) is, I think, far from ideal, and this would not have worked at all had we been dealing with C / C++.