def createTree(self, filename):
        """Create a new tree structure for when we open a file"""
        self.doClose()

        self.db = open_zodb(filename)
        self.db_layout_tree.SetImageList(self.il)

        self.root = self.db_layout_tree.AddRoot(os.path.basename(filename))
        self.db_layout_tree.SetPyData(self.root, self.db[0])
        self.db_layout_tree.SetItemImage(self.root, self.folder_idx,
                                         wx.TreeItemIcon_Normal)
        self.db_layout_tree.SetItemImage(self.root, self.folder_open_idx,
                                         wx.TreeItemIcon_Expanded)

        db = self.db[0]
        for key in db.keys():
            child = self.db_layout_tree.AppendItem(self.root, key)
            self.db_layout_tree.SetPyData(child, db[key])
            if isinstance(db[key], dict) or isinstance(db[key], list):
                self.db_layout_tree.SetItemImage(child, self.folder_idx,
                                                 wx.TreeItemIcon_Normal)
                self.db_layout_tree.SetItemImage(child, self.folder_open_idx,
                                                 wx.TreeItemIcon_Expanded)
            else:
                self.db_layout_tree.SetItemImage(child, self.file_idx,
                                                 wx.TreeItemIcon_Normal)

        self.db_layout_tree.Expand(self.root)
Create a new tree structure for when we open a file
recipes/Python/409012_A_Simple_ZODB_viewer_in_wxPython/recipe-409012.py