[PyQt] signal-slot connect problem

Aaron Digulla digulla at hepe.com
Wed Jan 9 10:24:10 GMT 2008

Quoting Phil Thompson <phil at riverbankcomputing.co.uk>:

>> I mean it is a very common mistake, even for advanced PyQt developers,
> Is it?

In my projects, I'm predefining all signals and slots as python  
constants and use those in connect() and emit(). a) makes the code  
more reliable and b) enables code completion.

An easy fix would be to have an extra module which defines all PyQt  
signals and slots from which one could import. The more comfortable  
fix is to have them in the individual PyQt classes, of course. I'd  
favor the second solution because it's non-intrusive (you can use it  
or now) and constants should be close to where they're used. Also the  
imports would be more simple and the whole thing would feel more clean  
(and it would cause a lot of trouble to move it back from solution #1  
when enough people ask for it).


Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."

More information about the PyQt mailing list