EditLabelメソッド
wx.ListCtrlクラスのEditLabelメソッドを実行しても項目が編集できないなと思い、色々いじっていたら、wx.LC_EDIT_LABELSを付け忘れていたことに気付く。
なってこった。
import sys import wx app = wx.PySimpleApp() frame = wx.Frame(None, -1, u"/(^0^)\", size=(300, 150)) lc = wx.ListCtrl(frame, wx.NewId(), style = wx.LC_REPORT | wx.LC_EDIT_LABELS, # これを忘れた ) for n, title in enumerate(('a', 'b', 'c')): lc.InsertColumn(n, title) d = (('abc', 'def', 'ghi'), ('jkl', 'mno'), ('pqr', 'stu'), ) for n, items in enumerate(d): index = lc.InsertStringItem(sys.maxint, items[0]) for m, subitem in enumerate(items[1:]): lc.SetStringItem(index, m+1, subitem) lc.SetItemData(index, n) frame.Show(True) lc.EditLabel(1) # jklを編集します app.MainLoop()