[PyKDE] Connect syntax.

Phil Thompson phil at riverbankcomputing.co.uk
Wed Sep 22 18:20:23 BST 2004


On Wednesday 22 September 2004 6:10 pm, Sundance wrote:
> Hello,
>
> It occured to me, while I was code-doodling today, that as it currently
> stands, the connect syntax in Python is just a tiny little bit more
> awkward than necessary.
>
> See:
>
> class MyNiftyLittleWidget(QSomeWidget):
>
>   def __init__(self, otherWidget):
>
>     # ...
>     # Blah
>     # ...
>     self.connect(self, PYSIGNAL("kissed()"), otherWidget.blush))
>
>
> self.connect(self ...) is just a little bit too awkward to fit nicely
> with either Python's cleanliness or Qt's lean efficiency. Makes it a
> fairly uncomfortable spot to be in when someone tries to advertise
> PyGTK as 'cleaner' to your boss. For instance.
>
> Could it be possible to make connect a global function of the qt Python
> module? Please? Like, "connect = QObject.connect" just at the end of
> the wrapper? This would be such a lot more logical and smoother.
>
> Allowing connect to work as an *instance* method would also be WAY cool:
>     self.myButton.connect(SIGNAL("clicked()"), self.doSomething)
> but it would likely much harder to implement -- although I certainly
> don't put it above Phil's abilities, please don't get me wrong.
>
> What do you think?

I have a policy of not (if at all possible) changing or "enhancing" the API.

Phil




More information about the PyQt mailing list