@a.nigam wrote:
Hello,
I have a question about syntax using rhinopython to create check boxes using Eto. I’ve been using Grasshopper for a while and have some programming experience with Java mostly and a little bit of python so this maybe a stupid question with a very easy answer but I cant seem to figure it out.
I would like to create a checkbox for each layer in the file. Normally, I would do it like this
# Create controls for the dialog self.m_label = forms.Label(Text = 'Layers:') if layers: for i in range (0,len(layers)): self.m_checkbox[i] = forms.CheckBox (Text = layers[i])This is the error I get
Message: 'UserInterface' object has no attribute 'm_checkbox'So for now, I’m doing it manually like this but it seems like a stupid way of doing it since different files might have different number of layers.
# Create controls for the dialog self.m_label = forms.Label(Text = 'Layers:') if layers: for i in range (0,len(layers)): self.m_checkbox = forms.CheckBox (Text = layers[0]) self.m_checkbox2 = forms.CheckBox (Text = layers[1]) self.m_checkbox3 = forms.CheckBox (Text = layers[2])Can anyone point me the correct way of doing this? Thanks
Posts: 5
Participants: 2