The label of the root node for CheckTreeControl not getting updated

Hi.

In my GUI, I created a treecontrol with checkboxes using the sample
code found in the following

http://mitglied.multimania.de/drpython/CheckTreeCtrl.tar

Also, I have a combobox which has a list of files present in the
current directory. When selecting one of the choices in the combobox,
the combobox event is supposed to update the label of the root node of
the checktree.
In the event handler (the function onSelectScriptFile () ) for the
combobox event , I have set the root node label as whatever value is
obtained from the event handler function. But still its not getting
updated. Kindly help.

    def onSelectScriptFile(self,e):
        self.eventobject = e.GetEventObject()
        self.eventvalue = str(self.eventobject.GetValue())
        print self.eventvalue,type(self.eventvalue)
        self.createTree()

    def createTree(self):
        self.tree = wx.TreeCtrl(self.pnl,-1,pos = (10,100),
                           style=ct.CT_AUTO_CHECK_CHILD|
wx.TR_DEFAULT_STYLE)
        self.mainroot = self.tree.AddRoot(self.eventvalue)
        self.tree.SetItemHasChildren(self.mainroot,True)
        self.tree.Expand(self.mainroot)

Regards,
Spondita

You are not updating the label in the current widget, you are creating a new treectrl widget.

···

On 5/11/12 2:49 AM, Spondita wrote:

Hi.

In my GUI, I created a treecontrol with checkboxes using the sample
code found in the following

  http://mitglied.multimania.de/drpython/CheckTreeCtrl.tar

Also, I have a combobox which has a list of files present in the
current directory. When selecting one of the choices in the combobox,
the combobox event is supposed to update the label of the root node of
the checktree.
In the event handler (the function onSelectScriptFile () ) for the
combobox event , I have set the root node label as whatever value is
obtained from the event handler function. But still its not getting
updated. Kindly help.

     def onSelectScriptFile(self,e):
         self.eventobject = e.GetEventObject()
         self.eventvalue = str(self.eventobject.GetValue())
         print self.eventvalue,type(self.eventvalue)
         self.createTree()

     def createTree(self):
         self.tree = wx.TreeCtrl(self.pnl,-1,pos = (10,100),
                            style=ct.CT_AUTO_CHECK_CHILD|
wx.TR_DEFAULT_STYLE)
         self.mainroot = self.tree.AddRoot(self.eventvalue)
         self.tree.SetItemHasChildren(self.mainroot,True)
         self.tree.Expand(self.mainroot)

--
Robin Dunn
Software Craftsman