rs.PropertyListBox() is broken

Hi everyone,

Looks like rs.PropertyListBox() for Python 3.9 is broken

#! python3

import rhinoscriptsyntax as rs

labels = ["a", "b"]
values = ["1", "2"]
name = "test"

new_values = rs.PropertyListBox(labels, values, name)

print(new_values)

@Alain - can you have a look at this?

Looks like the method xx.ToString() has been deprecated in Python 3.9.

Maybe the line in the rhinoscriptsyntax method

values = [v.ToString() for v in values]

needs to be changed to

values = [str(v) for v in values]

which seems to work in both Py2 and Py3.

1 Like

The issue is logged here

In the meantime you could just paste the function in your code:

#! python3

import rhinoscriptsyntax as rs
import Rhino

def PropertyListBox(items, values, message=None, title=None):
    values = [str(v) for v in values]
    return Rhino.UI.Dialogs.ShowPropertyListBox(title, message, items, values)

labels = ["a", "b"]
values = ["1", "2"]
name = "test"

new_values = rs.PropertyListBox(labels, values, name)

print(new_values)

Thanks for reporting.