[PyKDE] Emits and connects

Jan Ekholm chakie at infa.abo.fi
Wed Jul 4 13:44:08 BST 2001


Hi all,

I've used PyQt for a while with great success. Makes it really easy to do
apps. Now I did run into a problem with signals and slots. I want to emit
a custom signal in a class along with a few parameters and connect it to a
Python method. I've tried the following (rough pseudocode):

class A:

  def foo():
     self.emit (PYSIGNAL('oops(int,int)'), (x,y)) 
     self.emit (PYSIGNAL('oops'), (x, y))


class B:

  def bar():
    a = A ()
    self.connect ( a, PYSIGNAL('oops(int,int)'), self.oops )
    self.connect ( a, PYSIGNAL('oops'), self.oops )

  def oops (self,x,y):
    pass


None of the code gives any error, the emit():s are done ok, the
connect():s too (I usually get runtime errors if something is wrong), but
the callback oops() is just never called. There is something simple wrong
here, but what could that be?

Any hints? I use Linux, PyQt 2.4-pre1, Qt 2.3.0, sip-2.4pre2-1.


-----------------------------------------------------------------------------
      Real children don't go hoppity-skip unless they are on drugs.
           -- Susan Sto Helit, in Hogfather (Terry Pratchett)





More information about the PyQt mailing list