[Eric] How do you detect such an error?

Linos info at linos.es
Sun Feb 14 09:22:45 GMT 2010


Hello David,
	self.connect should return True if the connection has found the signature, so 
when for first time i write a connect and i am not sure i write "print 
self.connect(....)"

Regards,
Miguel Angel.

El 14/02/10 06:48, David Arnold escribió:
> All,
>
> What do you do when your code doesn't seem to throw any errors but does not work as expected? In this case, the error lies in:
>
>          self.connect(slider, QtCore.SIGNAL('valuechanged(int)'), lcd,
>                  QtCore.SLOT('display(int)'))
>
> Which should be:
>
>          self.connect(slider, QtCore.SIGNAL('valueChanged(int)'), lcd,
>                  QtCore.SLOT('display(int)'))
>
> How can you find errors like this?
>
> David
>
>
> # sigslot.py
>
> import sys
> from PyQt4 import QtGui, QtCore
>
> class SigSlot(QtGui.QWidget):
>      def __init__(self, parent=None):
>          QtGui.QWidget.__init__(self, parent)
>
>          self.setWindowTitle('Signals and Slots')
>
>          lcd = QtGui.QLCDNumber(self)
>          slider=QtGui.QSlider(QtCore.Qt.Horizontal, self)
>
>          vbox=QtGui.QVBoxLayout()
>          vbox.addWidget(lcd)
>          vbox.addWidget(slider)
>
>          self.setLayout(vbox)
>
>          self.connect(slider, QtCore.SIGNAL('valuechanged(int)'), lcd,
>                  QtCore.SLOT('display(int)'))
>
>          self.resize(250, 150)
>
> app=QtGui.QApplication(sys.argv)
> ss=SigSlot()
> ss.show()
> sys.exit(app.exec_())
>
> _______________________________________________
> Eric mailing list
> Eric at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/eric
>



More information about the Eric mailing list