Hi,
I found out that the font for the TreeCtrl item is not the system default font. I get the system default font and set the tree item font to it, then I find that the tree item text looks slightly different from the original one. So I write a small script to narrow down the problem, and find that wxpy crash!
This is my script:
···
##=================================================
import wx
class myFrame(wx.Frame): ## {{{
def __init__(self, *args, **kwds):
wx.Frame.__init__(self, *args, **kwds)
##------ panel
self.panel_=wx.Panel(self,-1)
self.sizer_ = wx.BoxSizer( wx.VERTICAL )
self.tree_ = wx.TreeCtrl(self.panel_,-1)
root = self.tree_.AddRoot('xxx')
##------ put stuff into sizer
self.sizer_.Add(self.tree_,proportion = 1,flag=wx.EXPAND)
## apply sizer
self.panel_.SetSizer(self.sizer_)
self.panel_.SetAutoLayout(True)
## this cause an error!!!!
default_font = self.tree_.GetItemFont(root)
print default_font
default_fontname = default_font.GetFaceName()
default_fontsize = default_font.GetPointSize()
print default_fontname
print default_fontsize
## }}}
def main(): ## {{{
app = wx.PySimpleApp(0)
frame = myFrame(None,-1,title='')
frame.Show(True)
app.SetTopWindow(frame)
app.MainLoop()
## }}}
if __name__ == "__main__":main()
##=================================================
Could Any kind soul help me out? Any help would be appreciated!
Best regards,
Bruce Who
2005\-05\-30