How do I add data to an item in a wxlistbox control?
Lets say I have a record of items, I wanna add their id from the database as the data of the item:
Label Data
--------------
Shoes 1
Watch 2
Bags 3
How do I add data to an item in a wxlistbox control?
Lets say I have a record of items, I wanna add their id from the database as the data of the item:
Label Data
--------------
Shoes 1
Watch 2
Bags 3
You can either add the items when you create the list, or append them later. Items are added as a list of strings. The following example shows items being added each way.
import wx
app = wx.App()
frame = wx.Frame(parent=None, id=-1, title = "Test List Box",size=(200,300) )
panel = wx.Panel(frame)
lb = wx.ListBox(panel,-1,(20,20),(100,200),["Shoes 1","Watch 2"])
lb.InsertItems(["Bags 3","Hats 5"],2)
frame.Show()
app.MainLoop()