I noticed in the latest service release candidate that the MultiListBox method is still not implemented in Python. This leads to two questions:
Will it be implemented soon?
Is there a workaround in the meantime.
I also want to mention that the CheckListBox seems to be broken. The traceback says “Specified cast is not valid.” and refers to line 46 in the userinterface.py script.
Just want to bring this to your attention. The MultiListBox is a very useful tool, and I use it a lot in Rhinoscript. I’m hoping it will be Python compatible in the near future.
Hi Dan,
MultiListBox was just recently added to the wish list for python. I’m not sure when this will be available; we’ll see what we can do about adding this for SR9.
If you look at the Help on CheckListBox, you see it wants you to supply a list of items - paired with their current checked state (in tuples).
import rhinoscriptsyntax as rs
list = [("apple",True), ("orange",False), ("banana",False), ("melon",True), ("pineapple",True)]
result = rs.CheckListBox(list, "Fruit", "Select your favorite")
#fruit = rs.ComboListBox(list, "Fruit", "Select your favorite")
#fruit = rs.ListBox(list, "Fruit", "Select your favorite")
selected=[]
for item in result:
if item[1]: selected.append(item[0])
print "You selected", selected
True, the method is not really set up for reporting the kind of error you created - submitting a simple list instead of a list of tuples - @stevebaer don’t know if perhaps the error reporting on this method could be improved…
Yes, you are correct, I did miss the “and a boolean check state” statement in the help file. I don’t believe I’ve ever used this method even in Rhinoscript, so I made the false assumption that I could work with the same list for all the list box methods. Checking the Rhinoscript help file, I see that an array of boolean values was required there too.