wxPython - AddRoot() method in wx.TreeCtrl Last Updated : 08 Jul, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article we are going to learn about AddRoot() method associated with wx.TreeCtrl class of wxPython. AddRoot() is a basic method used in order to add the root node to the tree, returning the new item. The image and selImage parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If image > -1 and selImage is -1, the same image is used for both selected and unselected items. Syntax: wx.TreeCtrl.AddRoot(self, text, image=-1, selImage=-1, data=None) Parameters Parameter Input Type Description text string text on node image int image parameter is an index within the normal image list specifying the image to unselected items, respectively. selImage int selImage parameter is an index within the normal image list specifying the image to selected items, respectively. data TreeItemData data for root item. Code Example: Python3 1== import wx class MainFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, parent = None, title ='TreeCtrl Demo') # tree control self.tree = wx.TreeCtrl(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize) # add a root node to tree self.root = self.tree.AddRoot('Root ') # expand tree self.tree.Expand(self.root) # show frame self.Show() if __name__ == '__main__': app = wx.App(redirect = False) frame = MainFrame() app.MainLoop() Output Window: Comment More infoAdvertise with us Next Article wxPython - Delete() method in wx.TreeCtrl R RahulSabharwal Follow Improve Article Tags : Python Python-gui Python-wxPython Python wxPython-TreeCtrl Practice Tags : python Similar Reads wxPython - Expand() method in wx.TreeCtrl In this article, we are going to learn about Expand() method associated with wx.TreeCtrl class of wxPython. Expand() method is used in order to expand and show children nodes of a particular item in Tree Control. This function takes the tree node item as a parameter to whom we want to expand. Syntax 1 min read wxPython - Delete() method in wx.TreeCtrl In this article we will learn about Delete() method associated with the class wx.TreeCtrl of wxPython. Delete() function is simply used in order to delete the specific item from the tree it can be root or terminal item. A EVT_TREE_DELETE_ITEM event will be generated. This function may cause a subseq 2 min read wxPython - AppendItem() method in wx.TreeCtrl In this article we will learn about AppendItem() method in wx.TreeCtrl class of wxPython. AppendItem() method is used to append an item to the end of the branch identified by parent, return a new item id. Append() method takes parent(wx.TreeItemId) as parameter. Syntax: wx.TreeCtrl.AppendItem() Para 1 min read wxPython - GetCount() method in wx.TreeCtrl The following article discusses GetCount() method associated with wx.TreeCtrl class of wxPython. GetCount() method is used in order to get the total number of items present in the control. Syntax: wx.TreeCtrl.GetCount(self) Parameters: No parameters are required by this method. Returns: It returns 3 min read wxPython - ExpandAll() method in wx.TreeCtrl In this article we are going to learn about ExpandAll() method associated with wx.TreeCtrl class of wxPython. ExpandAll() method is similar to Expand() but the only difference is that this method is used to expand all the items present in the Tree Control. All child nodes  along with their parent no 1 min read wxPython - EditLabel() method in wx.TreeCtrl In this article we are going to learn about EditLabel() method associated with wx.TreeCtrl class of wxPython. Starts editing the label of the given item. This function generates a EVT_TREE_BEGIN_LABEL_EDIT event which can be vetoed so that no text control will appear for in-place editing. If the use 1 min read Like