[PyKDE] One slot called two times

Carles Pina i Estany carles at pina.cat
Sat Oct 21 20:21:37 BST 2006


Hello,

I was used to connect signals and slots using "connect". Now I am
updating myself to Qt4 and using "autoconnect" feature. 

I have the simplest code that I can do and the slot is called two times.
The code is:

-------------------
#!/usr/bin/python

import sys
from PyQt4 import QtCore, QtGui
from ppal import *

class MainWindow(QtGui.QMainWindow):
        def __init__(self):
                QtGui.QDialog.__init__(self)
                self.ui = Ui_Form()
                self.ui.setupUi(self)

        def on_pushButton_clicked(self):
                print "pushbuttoncliecked slot"
                if int(str(self.ui.age.text()))>=18:
                        self.ui.answer.setText("Adult");
                else:
                        self.ui.answer.setText("not adult");

if __name__ == "__main__":
        app=QtGui.QApplication(sys.argv)
        window=MainWindow()
        window.show()
        sys.exit(app.exec_())
-------------------

I press one time and pushbutton_clicked slot is called two times.

I am using Debian with this packages:
ii  pyqt4-dev-tools                 4.0.1-3                     Development tools for PyQt4
ii  python-qt4-dev                  4.0.1-3                     Development files for PyQt4

I have searched on mailing list but I haven't found (I think that is my blame
:-)   )

Thanks!

-- 
Carles Pina i Estany		GPG id: 0x8CBDAE64
	http://pinux.info	Manresa - Barcelona




More information about the PyQt mailing list