refresh the screen after update in TreeCtrl?

hi, i can't figure out how to refresh the TreeCtrl to reflect changes
when i update it in responding to an event.. For example, in def
OnItemExpanded(self, event), the code in the example is:
def OnItemExpanded(self, event):
        item = event.GetItem()
        if item:
            self.log.WriteText("OnItemExpanded: %s\n" %
self.tree.GetItemText(item))

however, i changed it to:
def OnItemExpanded(self, event):
        item = event.GetItem()
        if item:
            self.tree.SetPyData(item, "new item")

how do you refresh it after adding the new item? or did i even do it
right? thanks alot!

···

--
www.programer.name - my own personal blog : )

"It's a wonderful world hobbes ol' buddy, let's go explorin'!" -
Calvin in "Calvin and Hobbes"

According to the docs:
    SetPyData(item, obj) - Associate the given Python Object with the
                           wxTreeItemData for the given item Id.

To actually add a child to a tree node, you should instead use:
    AppendItem(const wxTreeItemId& parent, const wxString& text, int
               image = -1, int selImage = -1,
               wxTreeItemData* data = NULL) -

        Appends an item to the end of the branch identified by parent,
        return a new item id.

And you would use it like:
    self.tree.AppendItem(item, "new item")

- Josiah

···

Jason Wang <randomtalk@gmail.com> wrote:

hi, i can't figure out how to refresh the TreeCtrl to reflect changes
when i update it in responding to an event.. For example, in def
OnItemExpanded(self, event), the code in the example is:
def OnItemExpanded(self, event):
        item = event.GetItem()
        if item:
            self.log.WriteText("OnItemExpanded: %s\n" %
self.tree.GetItemText(item))

however, i changed it to:
def OnItemExpanded(self, event):
        item = event.GetItem()
        if item:
            self.tree.SetPyData(item, "new item")

how do you refresh it after adding the new item? or did i even do it
right? thanks alot!