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

List:       pykde
Subject:    Re: [PyQt] simpler 'connect' function
From:       Ewald de Wit <erdewit () zonnet ! nl>
Date:       2008-01-17 10:10:56
Message-ID: 200801171110.56518.erdewit () zonnet ! nl
[Download RAW message or body]

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).

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'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
[prev in list] [next in list] [prev in thread] [next in thread] 

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