I Fixed it...I just needed to "read" the error message to figure out what was happening.
The problem was that :
- "CSheet's parent was the panel "self.Item_tab" and
- "self.Item_tab"s parent was the panel "self.notebook" and
- "self.notebook"s parent was "self.panel_main" and
- "self.panel_main" parent was "class BOLFrame's" frame
( see the sudo code below for the details)
To fix it I rearranged some code and added on line of code. The code in class BOLFrame not looks like this:
...
self.tcTotalWeight = wxTextCtrl(self.Item_tab, -1, "") # create the text control
self.Item_tab.tcTWeight = self.tcTWeight # give the "parent" self.Item access to it
self.grid = SheetBOL(self.Item_tab) # now, create the grid
...
>
>I have a class BOLFrame which is a wxFrame with a few widgets on it
>
>One of the widgets is a wxTextCtrl. There is also a wxGrid on the panel.
>
>Is it possible to update the value in the "parent" wxTextCtrl within the "child" wxGrid???
>
>Sudo code :
>
>#================
>class CSheet(wxGrid):
> def __init__(self, parent):
> wxGrid.__init__(self, parent, -1)
> ....
>#===============
>class SheetBOL(CSheet):
> def __init__(self, parent):
> CSheet.__init__(self, parent)
> ....
> something happens here and I want to update the
> "parent's" wxTextCtrl "tcTotalWeight"
> ....
>
>#===============
>class BOLFrame(wxFrame):
> wxFrame.__init__(self, parent)
> self.panel_main = wxPanel(self, -1)
> self.notebook = wxNotebook(self.panel_main, -1, style=wxNB_BOTTOM)
···
self.Item_tab = wxPanel(self.notebook, -1)
> ...
> self.grid = SheetBOL(self.Item_tab)
> self.tcTotalWeight = wxTextCtrl(self.Item_tab, -1, "")
> ...
> sizer_Item_pane.Add(self.grid, 1, wxEXPAND, 0)
> sizer_Item_pane.Add(self.tcTotalWeight, 1, wxALL, 10)
> ...
>