title: Create dynamic button in PyQt
body: <p>I try to add a function in a PyQt class, but it always returns me an error.</p>
  
  <pre><code># Error: TypeError: connect() slot argument should be a callable or a signal, not 'NoneType' # 
  </code></pre>
  
  <pre class="lang-py prettyprint-override"><code>def commander (self, arg):
      exec arg    
  
  def aButton (self, layout, **kwargs):
      name = kwargs.pop("name","Button")
      command = kwargs.pop("command", "" )
      button = QtGui.QPushButton(name)
      button.clicked.connect(self.commander(command))
      layout.addWidget(button)
      return button
  </code></pre>
  
  <p>May be someone here can help me to solve that :')
  Thx !</p>