The following program crashes when pressing return after typing some
characters in the editing control. It seems only to crash if editing is
initiated by using EditLabel().
from wxPython.wx import *
class MyFrame(wxFrame):
def __init__(self, parent, id, name):
wxFrame.__init__(self, parent, id, name)
listctrl = wxListCtrl(self, -1, size = (200, 200),
style = wxLC_REPORT | wxLC_HRULES | wxLC_SINGLE_SEL | wxLC_EDIT_LABELS)
sizer = wxBoxSizer(wxVERTICAL)
sizer.Add(listctrl, option = 1, flag = wxEXPAND)
self.SetSizerAndFit(sizer)
self.Show()
listctrl.InsertColumn(0, "HEADER")
listctrl.InsertStringItem(0, "FOO")
EVT_LIST_BEGIN_LABEL_EDIT(listctrl, -1, self.on_begin_edit)
EVT_LIST_END_LABEL_EDIT(listctrl, -1, self.on_end_edit)
listctrl.EditLabel(0)
def on_begin_edit(self, evt):
print "BEGIN!"
def on_end_edit(self, evt):
print "END!"
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(NULL, -1, "Hello from wxPython")
frame.Show(true)
self.SetTopWindow(frame)
return true
app = MyApp(1)
app.MainLoop()
···
--
/Jesper