import wx
class ListBoxFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, 'List Box Example',
size=(250, 200))
panel = wx.Panel(self, -1)
sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
'six', 'seven', 'eight', 'nine', 'ten', 'eleven',
'twelve', 'thirteen', 'fourteen111111111']
#listBox = wx.ListBox(panel, -1, (20, 20), (80, 120), sampleList,wx.LB_MULTIPLE)
listBox = wx.PreListBox()
listBox.Create(panel, -1, (20, 20), (80, 120), choices = sampleList,style. = wx.LB_MULTIPLE)
#listBox.SetSelection(3)
if __name__ == '__main__':
app = wx.PySimpleApp()
ListBoxFrame().Show()
app.MainLoop()
步骤:1、调用相应的pre函数
2、执行相应的对象的create函数