[PyKDE] callback not being called

Tony Cappellini cappy2112 at gmail.com
Sun Jan 21 17:05:40 GMT 2007


I've trying to understand how to make a cmd button call a method when the
button is pressed.

I havne't been seen an example in the Signals & Slots section of the QT docs
which  describe how to connect a widget signal to a callback function, only
how to call a widget slot function.
I don't get any runtime errors in my attempt to do this, but the callback
function isn't being called.

What is the preferred method of registering a non-widget slot to be called
by a widget signal?


class Dialog(QtGui.QDialog):

    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.patchBrowser = QtGui.QTextEdit()
        # layout code omitted for brevity

    def updateTextBox(self): # this function shoul dbe called, when the
button is pressed
        self.patchBrowser.setPlainText(self.tr("Callback was called"))

    def createPatchnameComboBox(self):
        self.patchNames = QtGui.QComboBox()
        self.patchNames.addItem("Entry 1")
        self.patchNames.addItem("Entry 2")

        # layout code omitted for brevity

        #self.connect(self.patchNames, QtCore.SIGNAL("higlighted"), self,
QtCore.SLOT("updateTextBox") ) # doesn't call updateTextBox
        self.connect(self.patchNames, QtCore.SIGNAL("activated"), self,
QtCore.SLOT("updateTextBox") )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070121/2ad748c8/attachment.html


More information about the PyQt mailing list