ETO forms and Radio Buttons

Hi hope you all had a good Christmas.

I am struggling with an ETO form and need some assistance.

Can anyone please show me the code that when I select the radio button for Fit Plane the input box for Thickness becomes de activated so no input is possible.

I am only self taught in programming so please keep it as simple as possible ideally if you can actually write the code and show me I might understand where I have been going wrong I have been trying for a while now and have just confused myself.

Associate Pts and Surfaces (13.5 KB)

I hope this discussion can help you:

Afraid it doesn’t help as I am not working with the drop down list but a totally separate text box which I want to disable based upon the radio button choice.
If this does work then I dont know how to apply it.

I don’t think the drop-down list was discussed in the post but how to deactivate RadioButton which if I’m not mistaken would be what you want to achieve, and the important part is this code of this file:

and also the last posts of the discussion that I linked before

Hi @RogerD,

you might subscribe to the SelectedValueChanged event of your RadioButtonList like so:

self.m_radiobuttonlist.SelectedIndex = 0
self.m_radiobuttonlist.SelectedValueChanged += self.MyRadioButtonListSelectedValueChanged

then create a new function in your class which handles the event:

def MyRadioButtonListSelectedValueChanged(self, sender, e):
    '''disable m_Thickness_textbox if Fit Plane is enabled'''
    if isinstance(sender, forms.RadioButtonList):
        if sender.SelectedValue.ToString() == "Fit Plane":
            self.m_Thickness_textbox.Enabled = False
            self.m_Thickness_textbox.Enabled = True

Here is the whole script for reference: Associate Pts and Surfaces (13.9 KB)

all the best for the new year!



I read it as the drop down list for the radio buttons but my issue is a separate text box being acted upon based on the selection of the radio buttons.

Hi Clement,

Many thanks for the revised script, I was only a third of the way there, the line below I didnt even have. There is a lot to learn in ETO and I dont find a lot of info on it and very few examples.

if isinstance(sender, forms.RadioButtonList):

All the best for 2024 and once again many thanks.

Hi Clement,

Your help in December was the catalyst for me to try some other ETO forms but I have now created another problem for myself can I please ask you to take look at my script and explain where I have gone wrong. The dialogue opens up and I don’t want either box to be ticked but once I select one of the two tick boxes then I want the other to be disabled, easy right, well that’s what I thought but still cannot get it to work.

I re named the file to txt due to outlook you will need to rename it py.

If you don’t have time then please don’t put yourself out.

Geo Import Export 9-1.txt (13.3 KB)

Hi @RogerD, below is an example which seems to do it with your checkboxes:

Geo Import Export (14.0 KB)

Some hints how this works: I’ve just added a Tag to each checkbox so i can identify from which checkbox your event OnCCheckedChanged is fired once they are enabled or disabled:

def OnCCheckedChanged(self, sender, e):
    if not isinstance(sender, forms.CheckBox): return
    if sender.Tag == "Import":
        if sender.Checked:
            self.m_export_checkbox.Checked = False
            self.m_export_checkbox.Enabled = False
            self.m_export_checkbox.Enabled = True

    elif sender.Tag == "Export":
        if sender.Checked:
            self.m_import_checkbox.Checked = False
            self.m_import_checkbox.Enabled = False
            self.m_import_checkbox.Enabled = True

The above function has some notes in the attached file. Note that by default, if you add a checkbox it is not checked by default. The reason why your checkboxes where both checked on start has been that you called the event using these two lines:


and your event basically just toggled the state (from False to True). I’ve therefore commented those two lines out.

Some basic tips: You have this line 6 times in your code:

import rhinoscriptsyntax as rs

better do all imports once at the top of the script.

btw. maybe checkboxes are not the right choice for the task. Why not use a RadioButtonList if only one choice (either import or export) is allowed ?


Hi Clement,

Many thanks for the reply and explanation, I appreciate you taking the time to help. I must admit I do struggle to find good information for reference when it comes to ETO and my knowledge is very limited just being self taught with no real structure to follow, I give it a go and hope for the best. Then when I can get no further I have man up and admit defeat and hope someone will give me some guidance.

I appreciate the rest of the script is messy I was bringing sections from other scripts and haven’t got round to tidying things up yet, but I will.

Once again many thanks and I hope from here on I should cope.

Hi Clement,

I have been revising my script that you kindly looked at for me and wondered if you can give me another pointer. I have removed the duplicate calls as discussed and have moved the check to see if the file is the main module to the end of the file as I think that is where it should and generally goes not in the middle of the script as I had it. This is where I now have a problem the script calls the dialogue box but does not allow me to select any points after I have selected my options.

I have tried every permutation I can think of with no joy so unsure what the problem is could you please give me a nudge in the right direction.

Geo Import Export 9-1 Clement.txt (13.6 KB)

Hi @RogerD,

the problem is that after you click OK in the dialog you have this in your function named

if rc:
        return dialog.GetImport(), dialog.GetExport(), dialog.GetFormatOption()

the first return will get you back to where you have called the function, which is this code:

if __name__ == "__main__":

the reason why nothing happens is simply because you have all the code to import / export points in the function you’ve just left. I’ve made some changes to your script and added some comments. Also note the comments which i wrote under these lines:

filenames = rs.OpenFileNames("Select SC4W Points Files")...........

here is your file with some changes: Geo Import Export 9-1 (14.0 KB)

btw. i don’t know why you’re not able to upload *.py files, it seems to work for me ?!


Hi Clement ,

Many thanks once again , I’m a slow learner but I’m sure I will get there. I have had problems when e-mailing py files and was unsure if there was any issue with uploading the same file extension, if you are advising me that py extensions are ok I will try in the future.

Off now to read and try to understand your corrections to my script.

I’m still looking for good beginners information for ETO forms, if you can recommend anything be it web based or book then please let me know, I have looked at most examples I can find but they don’t give a reason why something has or not been done a bit monkey see monkey do that will only get me so far.

Appreciate your time passing on your knowledge.

1 Like