Continuing the discussion from Toggle toolbar visibility without knowing its parent "collection":
Running the following script in my setup errors out on the line indicated:
import rhinoscriptsyntax as rs
def ToggleToolbarVisibility(tb_name):
for tb_coll in rs.ToolbarCollectionNames():
if rs.IsToolbar(tb_coll,tb_name): #<--Here
if rs.IsToolbarVisible(tb_coll,tb_name):
rs.HideToolbar(tb_coll,tb_name)
else:
rs.ShowToolbar(tb_coll,tb_name)
break
ToggleToolbarVisibility("ToolbarName")
The error message is: “expected int, got str”
IsToolbar () is expecting an index for tb_name and not a string.
Edit - Never mind… apparently the example I am using needs the third argument in IsToolbar() to be True. Otherwise, with the default=False it errors out. Still, somehow this should be error tolerant and return None, not blow up… No?
–Mitch