[PyQt] simpler 'connect' function

Ewald de Wit erdewit at zonnet.nl
Thu Jan 17 10:10:56 GMT 2008


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




More information about the PyQt mailing list