473,657 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

passing tuple with pyqt4 signal/slot mechanism

Hello,
I have a pyqt4 code in which i'm trying the signal/slot mechanism. The
(stripped) code is as follows:

class D(QtCore.QThrea d):
def __init__(self):
QtCore.QThread. __init__(self)
tpl = ("Primary", "priSec")
print "tpl:", tpl
self.emit(QtCor e.SIGNAL("setLa bel"), tpl)
class Gui(QtGui.QDial og):
def __init__(self, parent = None):
QtGui.QDialog._ _init__(self, parent)
def setLabel(self, tpl):
print "####tpl:", tpl
print "**********tpl: ", str(tpl)
return
if __name__ == "__main__":
app = QtGui.QApplicat ion(sys.argv)
dialog = Gui()
d = D()
QtCore.QObject. connect(d, QtCore.SIGNAL(" setLabel"),
dialog.setLabel , QtCore.Qt.Queue dConnection)
sys.exit(dialog .exec_())

The output i'm getting is as follows:

tpl: ('Primary', 'priSec')
####tpl: (<refcnt 0 at 0xb7caac8c>,)
**********tpl: ((((((((<NULL>, ),),),),),),),)

Can anyone kindly tell me what's happening here? Why is the tuple
("Primary", "priSec") getting converted to this <NULLthingy? And
what is this thingy anyways (It looks to be a deeply nested tuple, but
am not sure).

Thanks a lot!
--
warm regards,
Pradnyesh Sawant
--
Be yourself, everyone else is taken. --Anon
Apr 26 '07 #1
2 2259
Pradnyesh Sawant schrieb:
Hello,
I have a pyqt4 code in which i'm trying the signal/slot mechanism. The
(stripped) code is as follows:

class D(QtCore.QThrea d):
def __init__(self):
QtCore.QThread. __init__(self)
tpl = ("Primary", "priSec")
print "tpl:", tpl
self.emit(QtCor e.SIGNAL("setLa bel"), tpl)
class Gui(QtGui.QDial og):
def __init__(self, parent = None):
QtGui.QDialog._ _init__(self, parent)
def setLabel(self, tpl):
print "####tpl:", tpl
print "**********tpl: ", str(tpl)
return
if __name__ == "__main__":
app = QtGui.QApplicat ion(sys.argv)
dialog = Gui()
d = D()
QtCore.QObject. connect(d, QtCore.SIGNAL(" setLabel"),
dialog.setLabel , QtCore.Qt.Queue dConnection)
sys.exit(dialog .exec_())

The output i'm getting is as follows:

tpl: ('Primary', 'priSec')
####tpl: (<refcnt 0 at 0xb7caac8c>,)
**********tpl: ((((((((<NULL>, ),),),),),),),)

Can anyone kindly tell me what's happening here? Why is the tuple
("Primary", "priSec") getting converted to this <NULLthingy? And
what is this thingy anyways (It looks to be a deeply nested tuple, but
am not sure).
It's just wild guessing back from my Qt3-days - but isn't PYSIGNAL
instead of SIGNAL necessary here?

Diez
Apr 26 '07 #2
On Thursday 26 April 2007 3:41 pm, Diez B. Roggisch wrote:
Pradnyesh Sawant schrieb:
Hello,
I have a pyqt4 code in which i'm trying the signal/slot mechanism. The
(stripped) code is as follows:

class D(QtCore.QThrea d):
def __init__(self):
QtCore.QThread. __init__(self)
tpl = ("Primary", "priSec")
print "tpl:", tpl
self.emit(QtCor e.SIGNAL("setLa bel"), tpl)
class Gui(QtGui.QDial og):
def __init__(self, parent = None):
QtGui.QDialog._ _init__(self, parent)
def setLabel(self, tpl):
print "####tpl:", tpl
print "**********tpl: ", str(tpl)
return
if __name__ == "__main__":
app = QtGui.QApplicat ion(sys.argv)
dialog = Gui()
d = D()
QtCore.QObject. connect(d, QtCore.SIGNAL(" setLabel"),
dialog.setLabel , QtCore.Qt.Queue dConnection)
sys.exit(dialog .exec_())

The output i'm getting is as follows:

tpl: ('Primary', 'priSec')
####tpl: (<refcnt 0 at 0xb7caac8c>,)
**********tpl: ((((((((<NULL>, ),),),),),),),)

Can anyone kindly tell me what's happening here? Why is the tuple
("Primary", "priSec") getting converted to this <NULLthingy? And
what is this thingy anyways (It looks to be a deeply nested tuple, but
am not sure).

It's just wild guessing back from my Qt3-days - but isn't PYSIGNAL
instead of SIGNAL necessary here?
No, PyQt4 used SIGNAL for both Qt and Python signals.

Phil
Apr 26 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6540
by: AngelOfDarkness | last post by:
Hi guys, unfortunately I am pretty new to Python and Qt and all that. Well, I managed to successfully program a little stuff for my work (computational neuroscientist... no comment please), using a simple graphical interface and binding it to my long existing C library. There was no problem, everything was running fine... ... until I decided to upgrade everything to kubuntu's Edgy and PyQt4. Well, I understood that I need to port my...
2
4041
by: Glen | last post by:
Hello, I've written a script in python and put together a simple QFrame with a QTextBrowser with Designer. I've translated the C++ into python using puic4. The .py file is called outputWin.py. My Script and its functions are in cnt.py. Finally, my main is in pball.py which follows here: import sys from PyQt4 import Qt, QtCore from outputWin import * from cnt import *
0
1379
by: Pradnyesh Sawant | last post by:
Hello, i have the following code: ################################################################# import time import sys from PyQt4 import QtGui, QtCore class Counter(QtCore.QThread): def __init__(self): QtCore.QThread.__init__(self) def run(self):
2
3258
by: jiang.haiyun | last post by:
Hi, I am having some serious problems with PyQT4, when i run pyqt script, I always get 'Segmentation fault'. the script is simple: ====================== %less qttest.py from PyQt4 import QtGui, QtCore import sys
9
3482
by: bullockbefriending bard | last post by:
i have a large collection of python objects, each of which contains an integer 6-tuple as part of its data payload. what i need to be able to do is select only those objects which meet a simple tuple element wildcard matching criterion. e.g. given the following python objects: object A includes tuple (1,2,3,4,5,6) object B includes tuple (1,4,4,4,11,1) object C includes tuple (1,3,9,1,1,1) all tuples are unique. for what it's worth,...
0
3364
by: kunalgalav | last post by:
Hi , I am a newbie to python and I am trying to send a signal to my application using a thread. Here's my code: import sys from PyQt4 import QtGui, QtCore from PyQt4.QtCore import * class MyThread(QtCore.QThread,QtCore.QObject): def __init__(self, parent):
0
982
by: Phil Thompson | last post by:
On Sunday 04 May 2008, Lance Gamet wrote: I think QMainWindow.setCentralWidget() is what you are looking for. The eric4 IDE probably covers most things you'll ever need. Phil
2
2200
by: Bighead | last post by:
I remember when I did UI Design in PyQt4 for the first time, I found a manual. In it, no "connect" was used. Instead, an OO approach is applied, new UI classes inherit from old ones, and all the slot functions are automatically connected to some signals, using a decorator. In the __init__ function of our newly written class, "connect" is not invoked. I like this style... Unfortunately, I cannot find that manual now.... So anyone have...
3
2556
by: ff | last post by:
Is it possible to create custom PyQt4 Slots, i have searched high and low to no avail; I have an application that can set animation speed to different levels, i want the user to alter this, now quite clearly i can write a single function to control setting any speed with something like: def setSpeed(self, speed): some code in here to set speed
0
8425
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8845
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8622
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1736
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.