How can I store button, listbox and other wxpython widgets in an array? My problem is something like this:
I have a list such as list1=[a, b,c,d,….n].
I want to iterate through the first loop and use that as a label for by button. My approach was
Button_Array=[]
for i in List1:
New_Button=wx.Button(panel,-1,label=list1[i])
Button_Array.append(New_Button)
How can this be done?
I think you wanted something like this:
Note that when you loop over a list, the “i” is each item in the list, which in this case is a string. I would rename “i” to “lbl” to make it clearer what you’re doing.