I would like to see some simple code.
Got it! The culprit is the wx.TR_HIDE_ROOT settng. You can see the problem by changing TestTreeCtrlPanel.__init__ in the wxPython wx.TreeCtrl demo as follows:
1. Enable the previously commented out wx.TR_HIDE_ROOT setting in the following code:
self.tree = MyTreeCtrl(self, tID, wx.DefaultPosition, wx.DefaultSize,
wx.TR_HAS_BUTTONS
> wx.TR_EDIT_LABELS
#| wx.TR_MULTIPLE
> wx.TR_HIDE_ROOT ### Newly enabled.
, self.log)
2. Add the following code:
font = wx.Font(pointSize=12,
family = wx.FONTFAMILY_TELETYPE, # wx.FONTFAMILY_ROMAN,
style = wx.FONTSTYLE_NORMAL,
weight = wx.FONTWEIGHT_NORMAL,
)
3. Call self.tree.SetItemFont after the calls to self.tree.AppendItem. There are three such calls, but you can see the problem if you simply change the top-level items:
child = self.tree.AppendItem(self.root, "Item %d" % x) # Unchanged
self.tree.SetItemFont(child,font) ### Newly added.
Notice that the 'm' in 'Item' is truncated.
The About wxPython window reports: wxPython 2.7.1.3, wxMSW, unicode, wx-assertion-on, SWIG-1.3.29, Running on Python 2.4.
HTH.
Edward
···
--------------------------------------------------------------------
Edward K. Ream email: edreamleo@charter.net
Leo: http://webpages.charter.net/edreamleo/front.html
--------------------------------------------------------------------