+ Reply to Thread
Results 1 to 5 of 5

Thread: CheckListBox

  1. #1

    CheckListBox

    Hi all, I've tried to make CheckListBox and get output in case it's True, could anyone be able to advise how to get that done. Thanks, James

    import rhinoscriptsyntax as rs

    K1 = [('aa',True),('bb',True),('cc',False),('dd',False)]

    Kfactor = rs.CheckListBox(K1, "Input Effective length factor, K", "Kfactor")
    print Kfactor

  2. #2
    Super Moderator Mitch's Avatar
    Join Date
    May 2010
    Location
    Switzerland
    Posts
    285
    You do have one too many arguments supplied to CheckListBox but the last one seems to be ignored... So the code you posted seems to be working. It returns a list of tuples with (name,value) the value being true or false depending on what was checked. What is it you want to do? Are you looking to get some numerical input from the user? You would need RealBox for that, or you could look at PropertyListBox for a name/value combination.

    --Mitch

  3. #3
    Hi Mitch, Thank you for your promptly reply. I would actually like to get a value out of the CheckBoxList as per attached. Thanks, James
    Attached Images

  4. #4
    Super Moderator Mitch's Avatar
    Join Date
    May 2010
    Location
    Switzerland
    Posts
    285
    Hi,
    I think the only input box method that is limited to one unique choice is the ListBox. You could convert your list of values into a list of strings and then feed those to the ListBox, if there is a return you can then convert back to a float.
    python Code:
      import rhinoscriptsyntax as rs
       
      vals=[0.5,0.7,1.0,1.5]
      stringVals=[str(n) for n in vals]
      msg="Choose effective length factor"
      choice=rs.ListBox(stringVals,msg,"KFactor",stringVals[2])
      if choice != None:
          KFactor=float(choice)
          print KFactor

    The above could be embellished a bit with some more user-friendly words but you get the idea.
    --Mitch

  5. #5
    Hi Mitch,

    Thank you very much for your help.

    James

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts