wxListCtrl插入数据后不能显示

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

wxListCtrl插入数据后不能显示

zinicl
        self.list = wx.ListCtrl(self, -1, style = wx.LC_REPORT|wx.LC_HRULES|wx.LC_VRULES|wx.NO_BORDER)
        box.Add(self.list, 1, wx.EXPAND)
        self.SetSizer(box)

        self.list.InsertColumn(0, 'a1')
        self.list.InsertColumn(1, 'a2')

        self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE_USEHEADER)
        self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE_USEHEADER)

#到这里的显示都是正常的

        while True:
                ........
                idx = self.list.InsertStringItem(sys.maxint, path)
                self.list.SetStringItem(idx, 1, str(items[0]))
                self.list.SetStringItem(idx, 2, str(items[1]))
                ........

#到这里以后连head都不显示任何文字了,list里面没有任何数据

_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: wxListCtrl插入数据后不能显示

limodou
On Jan 8, 2008 4:10 PM, zinicl <[hidden email]> wrote:

>         self.list = wx.ListCtrl(self, -1, style =
> wx.LC_REPORT|wx.LC_HRULES|wx.LC_VRULES|wx.NO_BORDER)
>         box.Add(self.list, 1, wx.EXPAND)
>         self.SetSizer(box)
>
>         self.list.InsertColumn(0, 'a1')
>         self.list.InsertColumn(1, 'a2')
>
>         self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE_USEHEADER)
>         self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE_USEHEADER)
>
> #到这里的显示都是正常的
>
>         while True:
>                 ........
>                 idx = self.list.InsertStringItem(sys.maxint, path)
>                 self.list.SetStringItem(idx, 1, str(items[0]))
>                 self.list.SetStringItem(idx, 2, str(items[1]))
>                 ........
>
> #到这里以后连head都不显示任何文字了,list里面没有任何数据
>
只有两个,怎么插入三列呢?是不是报错了。

--
I like python!
UliPad <<The Python Editor>>: http://code.google.com/p/ulipad/
meide <<wxPython UI module>>: http://code.google.com/p/meide/
My Blog: http://www.donews.net/limodou
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese