interaction between classes ?

Hey,
here's my piece of code :

class HtmlWindow(wxHtmlWindow):
    def __init__(self,parent,id):
        wxHtmlWindow.__init__(self,parent,id)

class channelTree(wxTreeCtrl):
    def __init__(self,parent,id):
        wxTreeCtrl.__init__(self,parent,id)
        self.root = self.AddRoot("Sites")
        for i in range(len(names)):
            self.AppendItem(self.root,names[i])
        EVT_TREE_SEL_CHANGED(self,105,self.OnCelChanged)

    def OnCelChanged(self,event):
        item = event.GetItem()
        print self.GetItemText(item)

class MainSplitter(wxSplitterWindow):
    def __init__(self,parent,id):
        wxSplitterWindow.__init__(self,parent,id)
        self.html = HtmlWindow(self,-1)
        self.html.LoadPage("welcome.html")
        self.SplitHorizontally(self.html,wxWindow(self,-1),500)
        self.Show(1)

If you look at the channelTree class I've created a wxTreeCtrl when you
change a sel a execute onCelChanged Now I would like that when you
change a sel he loads an other page into the HtmlWindow. But I don't
really have an idea on how to do this any help ?

Geiregat Jonas wrote:

Hey,
here's my piece of code :

class HtmlWindow(wxHtmlWindow):
   def __init__(self,parent,id):
       wxHtmlWindow.__init__(self,parent,id)

class channelTree(wxTreeCtrl):
   def __init__(self,parent,id):
       wxTreeCtrl.__init__(self,parent,id)
       self.root = self.AddRoot("Sites")
       for i in range(len(names)):
           self.AppendItem(self.root,names[i])
       EVT_TREE_SEL_CHANGED(self,105,self.OnCelChanged)

   def OnCelChanged(self,event):
       item = event.GetItem()
       print self.GetItemText(item)

class MainSplitter(wxSplitterWindow):
   def __init__(self,parent,id):
       wxSplitterWindow.__init__(self,parent,id)
       self.html = HtmlWindow(self,-1)
       self.html.LoadPage("welcome.html")
       self.SplitHorizontally(self.html,wxWindow(self,-1),500)
       self.Show(1)

If you look at the channelTree class I've created a wxTreeCtrl when you
change a sel a execute onCelChanged Now I would like that when you
change a sel he loads an other page into the HtmlWindow. But I don't
really have an idea on how to do this any help ?

Store a reference to the html window in your channelTree class and then call self.html.LoadPage in OnCelChanged.

···

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