The objects are diffrerent because they are C++ pointers encapsulated in
python
objects. When you call the function twice, you get 2 different pointers,
and
No! No! No!!!!!! I am being misunderstood. I don't care about comparing
objects. I don't want to compare objects.
All I am trying to do is call tree.GetParent().GetParent() in order to work
my way up to a wxMDIParentFrame. I want to use this as the parent argument
to a wxMDIChildFrame constructor call. It does not work! The constructor
call fails because it thinks that I am trying to pass a wxWindow as a parent
(instead of a wxMDIChildFrame).
However, if I save the wxMDIParentFrame in a global variable and pass that
it works fine. I'm guessing that some some sort of slicing is going on
through the call to GetParent(), but it is just a guess.
The two print statements are printing reference to the same object; just
accessing them in different ways. The reference produced by the call to
GetParent().GetParent() seems to be be returning a sliced object. If I use
the commented version I get no errors.
print g_frame # this is the top level frame window
parent = self.tree.GetParent().GetParent()
print parent # this is the same top level frame window object
MyTabbedMDIChildFrame(parent, -1, self.device.GetTitle() + ":
Document", \
wxPoint(10,10), wxSize(40,40))
## # kludge using global
## MyTabbedMDIChildFrame(g_frame, -1, self.device.GetTitle() + ":
Document", \
## wxPoint(10,10), wxSize(40,40))
Here are the errors reported at runtime
<C wxMDIParentFrame instance at _1c87130_wxMDIParentFrame_p>
<C wxWindow instance at _1c87130_wxWindow_p>
Traceback (innermost last):
bla, bla, bla
File "E:\Python\wxPython\mdi.py", line 82, in __init__
self.this = apply(mdic.new_wxMDIChildFrame,_args,_kwargs)
TypeError: Type error in argument 1 of new_wxMDIChildFrame. Expected
_wxMDIParentFrame_p.