I am trying to add a ArrayStringProperty to a property sheet, but am having issues to setup the proper value for the data field from a given string.
My first attempt with a fixed value works well enough.and I get the expected property for
sp = wx.propgrid.ArrayStringProperty(cleanName,value=[‘A’,‘B’,‘C’])
pA = gridAll.Append(sp)
When I need to handle a string value of 'Tom, Dick, Harry", I am stuck on how to convert that string to an acceptable value for a similar line in place of [‘A’,‘B’,‘C’]
Thank you.
It did clarify/muddy my problem.
I finally realized that the data ‘val’ I want to display is actually returned as a list,and if I use
print(val)
it prints
['Tom', 'Dick', 'Harry']
but my call to
sp = wx.propgrid.ArrayStringProperty(cleanName, value=val ) fails with
typeError: ArrayStringProperty() arguments did not match any over loaded call
overload 1: argument ‘value’ has unexpected type ‘str’
I think value needs to be a list of strings and not a single string. So, if you are starting with a single string of names separated by a comma and a space, you need to split the string (as in my example) and pass the result of the split as the value.