wxPython – AddRoot() method in wx.TreeCtrl
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.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Syntax: wx.TreeCtrl.AddRoot(self, text, image=-1, selImage=-1, data=None)
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.