[wxPython] wxNotebook GetPage() should return obj that was AddPage'd, no?

i think of a wxNotebook as a container widget. you AddPage's to its
container space, and so i get this feelin that

  notebk.AddPage(my_beautiful_object, ...)
  ... hours later ...
  num = notebk.GetSelection()
  obj = notebk.GetPage(num)

should make obj a reference to the object that got added to the
container -- i.e., my_beautiful_object.

but such seems not to be the case. i find that, in this case, obj is a

  <C wxTextCtrl instance at _96f138_wxTextCtrl_p>

which seems TOTALLY not helpful. i want a reference to the
(higher-level) object I AddPage'd to the Notebook. my beautiful_object
in this case is an instance of a subclass of a subclass of wxTextCtrl.

i'm missing something, right? how do i get a reference to the object
sitting in the selected Notebook page??? and why does GetPage()
return some reference to some low level object??? should not there be
a GetLowLevelAllTheDetailsAnyoneCouldWantPage() for that kind of thing
and make GetPage() – (ahem IMHO) sane???

thanks much...

les schaffer

p.s. yes, i know i could subclass wxNotebook and keep my own list of
references to pages as they get added, but woulda thought wxNotebook
should be doing that.

.....

from PyUtilities.Sandbox.prntxtwx import PrintableTextControl
class NotebookTextCtrl(PrintableTextControl):
    """NotebookTextCtrl(parentNotebook, Label, File = None) is a
    wxTextCtrl widget which sits inside a parent Notebook, with tab
    label Label and optionally filled with contents of File."""

    _style = wxTE_MULTILINE | wxTE_READONLY | wxHSCROLL

    def __init__(self, parentNoteBk, Label, File = None):
        self.__pageNo = parentNoteBk.GetPageCount()
        self._parent = parentNoteBk
        textID = wxNewId()
        self.winIDs = {'textCtrl': textID}
        PrintableTextControl.__init__(self, parentNoteBk, textID, style = self._style)
        parentNoteBk.AddPage(self, Label)
        if File: self.addFileContents(File)

should make obj a reference to the object that got added to the
container -- i.e., my_beautiful_object.

but such seems not to be the case. i find that, in this case, obj is a

  <C wxTextCtrl instance at _96f138_wxTextCtrl_p>

which seems TOTALLY not helpful. i want a reference to the
(higher-level) object I AddPage'd to the Notebook. my beautiful_object
in this case is an instance of a subclass of a subclass of wxTextCtrl.

It's actually better than it used to be. Previous to 2.3.0 you would get a
wxWindow object, not a wxTextCtrl. Take a look at the OOR sample in the
demo for an explaination of what is going on and where I hope to be able to
take it in a future release.

p.s. yes, i know i could subclass wxNotebook and keep my own list of
references to pages as they get added, but woulda thought wxNotebook
should be doing that.

All wxNotebook knows about are the C++ objects you give it. The next phase
of the OOR will add the knowledge of which original python objects are
wrapping the C++ objects.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!