[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] simpler 'connect' function
From:       Mark Summerfield <mark () qtrac ! eu>
Date:       2008-01-17 10:46:42
Message-ID: 200801171046.42483.mark () qtrac ! eu
[Download RAW message or body]

On 2008-01-17, Ewald de Wit wrote:
> On Wednesday 16 January 2008 09:21:40 Aaron Digulla wrote:
> > As for making the API simpler, I'd opt for
> >
> >      button.connectClicked(self.buttonWasClicked)
>
> Wouldn't it be nicer if the signals where attributes of your object,
> so that you could write
>
> 	button.clicked.connect(self.onButtonClicked)
>
> (and likewise for disconnect).

That seems like a nice syntax to me.

Qt Jambi (Qt bindings for Java) uses a similar (but not quite as nice)
syntax:

    button.clicked.connect(this, "buttonClicked()");

> This is basically what C# uses, although there the += and -=
> operators are used for connect and disconnect respectively.
> To connect one would get:
>
> 	button.clicked += self.onButtonClicked

I'm not at all keen on this though.

>
> I've adopted this notation in my Python programs because I think
> it's the most visually appealing.
>
> --
>   -- Ewald
>
>
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt



-- 
Mark Summerfield, Qtrac Ltd., www.qtrac.eu


_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic