<span style="font-family: courier new,monospace;">Hello,</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">I&#39;ve created a simple window in Designer but can&#39;t get the connectSlotsByName function to connect up the button correctly when I&#39;ve loaded the UI with uic.loadUi. I can connect the button manually, or I can use pyuic and it works, but I can&#39;t for the life of me figure out why this won&#39;t connect. I&#39;ve looked all through the mailing list archives and google, but no I can&#39;t find my way out of it.</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">The code is attached, with relevant sections below.</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Here&#39;s the relevant code with loadUi:</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">class TestWindow (QtGui.QMainWindow):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    def __init__(self):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        QtGui.QMainWindow.__init__(self)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.ui = uic.loadUi(&quot;test.ui&quot;)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        QtCore.QMetaObject.connectSlotsByName(self)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        #self.ui.maxButton.clicked.connect(self.on_maxButton_clicked)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.ui.show()</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    @QtCore.pyqtSlot()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    def on_maxButton_clicked(self):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        print(&quot;max!&quot;)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Here is the working bit done with a file created by pyuic:</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">import testui</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">class TestWindow (QtGui.QMainWindow):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    def __init__(self):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        QtGui.QMainWindow.__init__(self)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.ui = testui.Ui_MainWindow()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.ui.setupUi(self)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.show()</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    @QtCore.pyqtSlot()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    def on_maxButton_clicked(self):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        print(&quot;max!&quot;)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><br><br>Thanks,<br>Peter O&#39;Malley<br style="font-family: courier new,monospace;">