[wxPython] mdi / getactivechild / identity

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[wxPython] mdi / getactivechild / identity

Markus Lindorfer
hi!

i've a problem finding the right frame (derived from wxmdichildframe)
using wxmdiparentframe.getactivechild.

using:
  for all frames in list:
    if id(frame) == id(getactivechild):
      found

doesn't succeed :-( because id(getactivechild)
differs all the time ...

anyone who has a working solution in mind?

thx in advance
  sascha



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] mdi / getactivechild / identity

Robin Dunn
> i've a problem finding the right frame (derived from wxmdichildframe)
> using wxmdiparentframe.getactivechild.
>
> using:
>   for all frames in list:
>     if id(frame) == id(getactivechild):
>       found
>
> doesn't succeed :-( because id(getactivechild)
> differs all the time ...
>
> anyone who has a working solution in mind?
>

The id() function gives you the id of the Python object, but this is just a
shadow of the real C++ object.  When you call methods that return objects or
object pointers (like wxMDIParentFrame.GetActiveChild) a new shadow of the
object is created, hence you have mismatched Python id's.

You might try comparing the .this attribute of each of the objects, at least
the portion that is a hex number.  That number is the address of the actual
C++ object.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users