panel=wx.Panel(self)
panel.SetBackgroundColour(wx.WHITE)
font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD)
self.field1 = wx.TextCtrl(panel,pos=(120,25),size=(170,20))
self.field2 = wx.TextCtrl(panel,pos=(120,90),size=(170,20))
self.field=[self.field1,self.field2]
field1_lbl=wx.StaticText(panel,-1, label='path1:', pos=(25, 25))
field1_lbl.SetFont(font)
field2_lbl=wx.StaticText(panel,-1, label='path2:', pos=(25,90))
field2_lbl.SetFont(font)
self.checkbox1=wx.CheckBox(panel, -1,'Default',pos=(240,45),size=(50,25))
self.checkbox1.SetValue(False)
self.checkbox1.Bind(wx.EVT_CHECKBOX,self.OnDefault)
self.checkbox2=wx.CheckBox(panel, -1,'Default',pos=(240,110),size=(50,25))
self.checkbox2.SetValue(False)
self.checkbox2.Bind(wx.EVT_CHECKBOX,self.OnDefault)
self.checkbox=[self.checkbox1,self.checkbox2]
def OnDefault(self,event):
for checkbox in self.checkbox:
for field in self.field:
if self.checkbox.Value==False:
self.field.Enable(True)
else:
self.field.Enable(False)
self.checkbox
リストオブジェクトの属性にアクセスするにはどうすればよいですか?エラーが発生します
Traceback (most recent call last):
File "D:\PROJECT\mypro.py", line 251, in OnDefault
if self.checkbox.Value==False:
AttributeError: 'list' object has no attribute 'Value'