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)