因程序要求,用的python2.3/wxpython2.4做界面,出现以下问题,一直没弄明白是为什么,怎么解决,请各位指教下,谢谢。
我主要是想在窗体中用wxTreeListCtrl控件,在‘1.PNG’中的'A1‘下方展示一个TREE,在'A2'下方展示对应节点项的其它信息,我现在的问题是:
- 如果我只在窗体添加wxTreeListCtrl一个控件,那么,窗体效果如图1,基本是我想要的那样,但不能对wxTreeListCtrl控件定位,给POS,它始终是0,0点那里。
- 一旦我往窗体添加第2个控件,那么wxTreeListCtrl控件加入的列名那行就没有了,不展示列名了,如图2
请各位不吝赐教!
我的代码如下:
from wxPython.wx import *
from wxPython.gizmos import wxTreeListCtrl
class Frame(wx.wxFrame):
def __init__(self, *_args,**_kwargs):
wx.wxFrame.__init__(self, *_args,**_kwargs)
self.tree = wxTreeListCtrl(self, -1, pos=(10, 100), size=(1100, 800),
style=wxTR_TWIST_BUTTONS | wxTR_EXTENDED | wxTR_MULTIPLE)
# create some columns
self.tree.AddColumn("A1")
self.tree.AddColumn("A2")
self.lb_blockName = wxStaticText(self, -1, '\xd7\xe9\xc1\xa2\xc3\xfb:', pos=(10, 10))
class App(wx.wxApp):
def OnInit(self):
self.frame = Frame(NULL, -1, '123')
self.frame.Show(true)
self.SetTopWindow(self.frame)
return True
def main():
app = App()
app.MainLoop()
if __name__ == '__main__':
main()