wx.TreeCtrl how to change the font

I’m trying to change the font of my TreeCtrl. When I first create it, I use this code to change the root:

font = wx.Font(10, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
self.tree.SetItemFont(self.root, font)

…and that works fine.

Then in my traverse method where I’m building the nodes, I can’t figure out how to change the font to the same as the root. In other words, isn’t there a way to change the entire tree font? Or do I have to change each node?

Here is my traverse code:

code.zip (609 Bytes)

Depending on the platform self.tree.SetFont(font) may work. Otherwise, you can use the value returned from AppendItem can be used to pass to SetItemFont to change that new item, instead of parent.

That worked. Thank you very much.