title: Qt - Create Widget dynamically
body: <p>I've this program I'm working on.</p>
  
  <p>It's a simple drum looper that generates midi sound and play them. I'm still in the design part.</p>
  
  <p>I placed all the widgets items, one by one by hand. </p>
  
  <p>It was a tedious labor, which I think could be made a lot quicker by creating them dynamically.</p>
  
  <p>How can I achieve this?</p>
  
  <p>As you can see my code looks like a mess:</p>
  
  <pre><code>self.kick_1 = QtGui.QCheckBox(self)
  self.kick_2 = QtGui.QCheckBox(self)
  self.kick_3 = QtGui.QCheckBox(self)
  self.kick_4 = QtGui.QCheckBox(self)
  self.kick_5 = QtGui.QCheckBox(self)
  self.kick_6 = QtGui.QCheckBox(self)
  self.kick_7 = QtGui.QCheckBox(self)
  self.kick_8 = QtGui.QCheckBox(self)
  self.kick_9 = QtGui.QCheckBox(self)
  self.kick_10 = QtGui.QCheckBox(self)
  self.kick_11 = QtGui.QCheckBox(self)
  self.kick_12 = QtGui.QCheckBox(self)
  self.kick_13 = QtGui.QCheckBox(self)
  self.kick_14 = QtGui.QCheckBox(self)
  self.kick_15 = QtGui.QCheckBox(self)
  self.kick_16 = QtGui.QCheckBox(self)
  self.kick_1.setGeometry(QtCore.QRect(120, 60, 16, 17))
  self.kick_2.setGeometry(QtCore.QRect(150, 60, 16, 17))
  self.kick_3.setGeometry(QtCore.QRect(180, 60, 16, 17))
  self.kick_7.setGeometry(QtCore.QRect(300, 60, 16, 17))
  self.kick_4.setGeometry(QtCore.QRect(210, 60, 16, 17))
  self.kick_5.setGeometry(QtCore.QRect(240, 60, 16, 17))
  self.kick_6.setGeometry(QtCore.QRect(270, 60, 16, 17))
  self.kick_14.setGeometry(QtCore.QRect(510, 60, 16, 17))
  self.kick_11.setGeometry(QtCore.QRect(420, 60, 16, 17))
  self.kick_8.setGeometry(QtCore.QRect(330, 60, 16, 17))
  self.kick_9.setGeometry(QtCore.QRect(360, 60, 16, 17))
  self.kick_12.setGeometry(QtCore.QRect(450, 60, 16, 17))
  self.kick_13.setGeometry(QtCore.QRect(480, 60, 16, 17))
  self.kick_10.setGeometry(QtCore.QRect(390, 60, 16, 17))
  self.kick_15.setGeometry(QtCore.QRect(540, 60, 16, 17))
  self.kick_16.setGeometry(QtCore.QRect(570, 60, 16, 17))
  </code></pre>
  
  <p>All of this just to create 16 check boxes and place them side by side(30 pixels apart)</p>