我使用这个代码来更新我在列上的记录,但是我不能更新第二和第三列。我遵循了这个链接,它正在工作,但我的代码不起作用。
self.m_listCtrl3 = wx.ListCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_ALIGN_TOP|wx.LC_ICON|wx.LC_REPORT )
self.m_listCtrl3.InsertColumn( 0, "c1", width=-1)
self.m_listCtrl3.InsertColumn( 1, "c2", width=-1)
self.m_listCtrl3.InsertColumn( 2, "c3", width=-1)
bSizer15.Add( self.m_listCtrl3, 1, wx.ALL|wx.EXPAND, 5 )
self.m_listCtrl3.InsertStringItem(0,"Pankaj")
self.m_listCtrl3.SetStringItem(0,1,"Somesh")
self.m_listCtrl3.SetStringItem(0,1,"Punit")
我得到的输出是:
发布于 2016-01-14 02:50:49
I got answer
i was using wx.LC_ICON style
self.m_listCtrl3 = wx.ListCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_ALIGN_TOP|wx.LC_ICON|wx.LC_REPORT )
but i removed that style and now code is working fine
self.m_listCtrl3 = wx.ListCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_ALIGN_TOP|wx.LC_REPORT )
发布于 2016-01-14 02:49:42
您要求它以多种格式显示。
选择wx.LC_REPORT或wx.LC_ICON,而不是两者兼而有之。
为了您在这里的目的,您需要wx.LC_REPORT
另外:
self.m_listCtrl3.SetStringItem(0,1,"Punit")
应该是
self.m_listCtrl3.SetStringItem(0,2,"Punit")
https://stackoverflow.com/questions/34787128
复制