title: Is there an efficient way to handle multiple checkboxes that change one variable in wxPython?
body: <p>I am working on a wxPython application with quite a lot of user-changeable options. That leads to a lot of checkboxes which need to be handled in some way.</p>
  
  <p>At the time, my code looks something like this:</p>
  
  <pre><code>        self.checkbox1=wx.CheckBox(self.panel,label='Do X')
          self.checkbox1.Bind(wx.EVT_CHECKBOX,self.DoXCheckboxHandler)
          self.checkbox1.SetValue(True)
          self.sizer.Add(self.checkbox1,0,wx.ALL|wx.EXPAND,5)
  
          self.checkbox2=wx.CheckBox(self.panel,label='Do Y')
          self.checkbox2.Bind(wx.EVT_CHECKBOX,self.DoYCheckboxHandler)
          self.checkbox2.SetValue(True)
          self.sizer.Add(self.checkbox2,0,wx.ALL|wx.EXPAND,5)
  ...
      def DoXCheckboxHandler(self,event):
          self.DoX=self.checkbox1.GetValue()
          self.RefreshUserView(self)
  
      def DoYCheckboxHandler(self,event):
          self.DoY=self.checkbox2.GetValue()
          self.RefreshUserView(self)
  ...
  </code></pre>
  
  <p>Is there any more efficient way (in terms of code-length) of handling multiple checkboxes, which all practically change only one variable and then call one and the same function? My approach, although working fine, seems like having a lot of unnecessary(?) repetition.</p>
  
  <p>Certainly one way to do it would be to skip the "extra" variable altogether - however, in practice I need to have those variables separately from the widgets - as I need the values even if the widgets are destroyed (after closing the options frame, for example). </p>
  
  <p>All advice will be appreciated.</p>