Tuesday, 15 May 2012

user interface - Having trouble adding wxListBox to frame -



user interface - Having trouble adding wxListBox to frame -

i trying add together wxlistbox frame, having difficulty.

this sample code

wx.frame.__init__(self,parent,title=title,size=(750,690), style=wx.minimize_box|wx.system_menu| wx.caption|wx.close_box|wx.clip_children) splitter = wx.splitterwindow(self) panel1 = panel1(splitter) panel2 = wx.panel(splitter,style=wx.sunken_border) splitter.splithorizontally(panel1,panel2,470) listbox = wx.listbox(splitter, -1, (20, 20), (80, 120), 0, wx.lb_single)

i getting error, controls.listbox_swiginit(self,controls.new_listbox(*args, **kwargs)) typeerror: sequence of strings expected.

your line:

listbox = wx.listbox(splitter, -1, (20, 20), (80, 120), 0, wx.lb_single)

should like:

listbox = wx.listbox(panel1, -1, (20, 20), (80, 120), [a list of choices], wx.lb_single)

instead of parenting splitter utilize 1 of panels or if want outside splitter utilize 'self' frame here.

you hardcoding sizes , positions, instead suggest using sizers. see e.g. http://wiki.wxpython.org/usingsizers or google search.

user-interface wxpython wxwidgets wx

No comments:

Post a Comment