Hello, I've created a simple window in Designer but can't get the connectSlotsByName function to connect up the button correctly when I've loaded the UI with uic.loadUi. I can connect the button manually, or I can use pyuic and it works, but I can't for the life of me figure out why this won't connect. I've looked all through the mailing list archives and google, but no I can't find my way out of it.
The code is attached, with relevant sections below.
Here's the relevant code with loadUi:
class TestWindow (QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.ui = uic.loadUi("test.ui")
QtCore.QMetaObject.connectSlotsByName(self)
#self.ui.maxButton.clicked.connect(self.on_maxButton_clicked)
self.ui.show()
@QtCore.pyqtSlot()
def on_maxButton_clicked(self):
print("max!")
Here is the working bit done with a file created by pyuic:
import testui
class TestWindow (QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.ui = testui.Ui_MainWindow()
self.ui.setupUi(self)
self.show()
@QtCore.pyqtSlot()
def on_maxButton_clicked(self):
print("max!")
Thanks,
Peter O'Malley
with-loadui.py
Description: Binary data
test.ui
Description: Binary data
testui.py
Description: Binary data
with-pyuic.py
Description: Binary data
_______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
