[PyQt] connect problem on windows xp

Fabio Mauri fabio.mauri at gmail.com
Thu Jul 29 16:28:56 BST 2010


I solved the issue following linjunhalida's suggestion:

adding QObject.__init__(self) in the __init__ function of my GUI,
everything turns fine also on windows.

Thank you linjunhalida, and thank you all!

On Thu, Jul 29, 2010 at 4:56 PM, F.A.Pinkse <fapinkse at gmail.com> wrote:
> Hi Fabio
>
> To see you print() statements you need to lauch your script with python
> If you use pythonw the script is lauched and the communication channels are
> closed.
>
> Or you use one of these:
>
>
>    def noneSelected(self):
>        print ("signal catched 2")
>        self.dtype.setText("signal catched 2")
>        msgBox=QtGui.QMessageBox()
>        msgBox.setText("signal catched 2")
>        msgBox.exec()
>
>    def refreshList(self):
>        print ("signal catched 1")
>        self.dtype.setText ("signal catched 1")
>        msgBox=QtGui.QMessageBox()
>        msgBox.setText("signal catched 1")
>        msgBox.exec()
>
> I 'borrowed one of the line/text edit widgets.
> Hope this helps.
>
>
> With best regards,
>
>
> Frans.
>
>
> Op 7/29/2010 12:46 PM, Fabio Mauri schreef:
>>
>> Ok, this below is a minimal example.
>> Launching this (with the gui file attached in the previous mail) in
>> Ubuntu 10.04 I can see the prints on cmdline when clicking on
>> pushbuttons, under windows xp I cannot see them.
>>
>> #!/usr/bin/python
>> from twisted.internet import reactor
>> from coherence.base import Coherence
>> from coherence.upnp.core import utils
>>
>> import sys
>> import time
>> from threading import Thread, Timer
>> from Wdw import Ui_Wdw
>> from PyQt4 import QtGui
>> from PyQt4 import QtCore
>> from PyQt4.QtCore import *
>> from PyQt4.QtGui import *
>>
>> class UPnPgui(QtCore.QObject, Ui_Wdw):
>>
>>     def __init__(self):
>>         self.version = "0.5b"
>>         return
>>
>>     def doConnections(self):
>>         QObject.connect(self.refresh, SIGNAL("clicked()"),
>> self.refreshList)
>>         QObject.connect(self.clearSel, SIGNAL("clicked()"),
>> self.noneSelected)
>>         return
>>
>>     def noneSelected(self):
>>         print "signal catched 2"
>>
>>     def refreshList(self):
>>         print "signal catched 1"
>>
>> if __name__ == "__main__":
>>     app = QtGui.QApplication(sys.argv)
>>     window = QtGui.QWidget()
>>     ui = UPnPgui()
>>     ui.setupUi(window)
>>     ui.doConnections()
>>     window.show()
>>     window.geometry()
>>     window.setWindowTitle(window.windowTitle() + " version " + ui.version)
>>     sys.exit(app.exec_())
>>
>> On Thu, Jul 29, 2010 at 9:32 AM, Sybren A. Stüvel<sybren at stuvel.eu>
>>  wrote:
>>>
>>> On Thu, Jul 29, 2010 at 08:59:16AM +0200, Fabio Mauri wrote:
>>>>
>>>> Attached you can find the Ui_Wdw class.
>>>
>>> That wasn't my point. Please make a *minimal* bit of code that shows
>>> your problem.
>>>
>>>> In the last connect, I used a different style because for such a
>>>> reason the QObject.connect() i used in the lines above wouldn't work
>>>> while the signal.connect() does (on Ubuntu 10.04).
>>>
>>> That's strange, as signal.connect() works just fine here (Ubuntu
>>> 10.04).
>>>
>>> Please try to make a minimal example, just one bit of code that shows
>>> the problem.
>>>
>>> --
>>> Sybren Stüvel
>>>
>>> http://stuvel.eu/
>>>
>>> -----BEGIN PGP SIGNATURE-----
>>> Version: GnuPG v1.4.6 (GNU/Linux)
>>>
>>> iD8DBQFMUS6h8ZTyn8Yy+5MRAqSpAJ9cdL4gUAHDLuTT2pF+4m9BpU3kbACfe9H+
>>> MMM3k69wFanU5O1GktogOlQ=
>>> =wAb4
>>> -----END PGP SIGNATURE-----
>>>
>>>
>>
>>
>>
>
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>



-- 
Fabio Mauri


More information about the PyQt mailing list