wxpython:无法更新列
wxpython : Unable to update Column
我正在使用此代码更新列中的记录,但我无法更新第 2 列和第 3 列。
我遵循了这个 link,它可以工作,但不适用于我的代码。
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")
我得到的输出是:
您要求它以多种格式显示。
选择 wx.LC_REPORT 或 wx.LC_ICON,但不能同时选择两者。
为了您的目的,您需要 wx.LC_REPORT
另外:
self.m_listCtrl3.SetStringItem(0,1,"Punit")
应该是
self.m_listCtrl3.SetStringItem(0,2,"Punit")
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 )
我正在使用此代码更新列中的记录,但我无法更新第 2 列和第 3 列。 我遵循了这个 link,它可以工作,但不适用于我的代码。
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")
我得到的输出是:
您要求它以多种格式显示。
选择 wx.LC_REPORT 或 wx.LC_ICON,但不能同时选择两者。
为了您的目的,您需要 wx.LC_REPORT
另外:
self.m_listCtrl3.SetStringItem(0,1,"Punit")
应该是
self.m_listCtrl3.SetStringItem(0,2,"Punit")
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 )