MultiListBox in Python

I noticed in the latest service release candidate that the MultiListBox method is still not implemented in Python. This leads to two questions:

  1. Will it be implemented soon?
  2. 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.

Thanks,

Dan

1 Like

Sorry, I wasn’t reading the Python code correctly.

Hi @stevebaer,

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.

Thanks,

Dan

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.

Great, I’ll watch for it then.

Thanks,

Dan

Really? I think I asked for this a long time ago when there was the old Python forum… Well, anyway, one more vote from me…

–Mitch

Sorry, I must have missed it back then. I am only human.

Sorry, Steve, that was in no way intended to be a criticism… :worried:

BTW, you are not human either though, you are SUPERhuman…!

–Mitch

I was just being a wisenheimer

I’m testing CheckListBox and am not able to find anything that is “broken”. Do you have a sample that makes the function not work?

Thanks

Hi @stevebaer,

Here is a little script that is failing for me. The traceback is the same as I mentioned earlier (“Specific cast is not valid”)

checklistbox issue.py (309 Bytes)

Thanks,

Dan

Hi Dan,

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…

HTH, --Mitch

Hi Mitch,

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.

Sorry for wasting everyone’s time with this.

Dan

It could, but it is very hard to predict all of the potential error conditions.

I am a “potential error condition”! :blush:

You can only idiot proof so much. Then someone like me comes along and raises (or lowers) the bar.

The good news is that this is getting easier, and hopefully the noobie questions are noticeably less.

Dan

1 Like

@stevebaer I can see some modifications are already going to be done for SR10. Could MultiListBox for python be one of them, please?
Thank you.

1 Like

Multilistbox for me also! +1