[PyQt] dip properties

José M. Rodriguez Bacallao jmrbcu at gmail.com
Tue Mar 13 13:23:26 GMT 2012


yes, I know that, the problem is that I want to shorten the code. For
example, I want to do this:

class Widget(QtGui.QWidget, Model):
    id = property(lambda self: self.objectName(), lambda self, v:
self.setObjectName(v))

instead of this:

class Widget(QtGui.QWidget, Model):
    id = Str()

    @id.getter
    def id(self):
        return self.objectName()

    @id.setter
    def id(self, value):
        self.setObjectName(value)


2012/3/13 Phil Thompson <phil at riverbankcomputing.com>:
> On Mon, 12 Mar 2012 10:40:33 -0400, José M. Rodriguez Bacallao
> <jmrbcu at gmail.com> wrote:
>> hi folks, how can I set lambdas as getters and setters of dip
> properties?
>
> dip's typed attributes (I assume that is what you mean by properties) are
> declarative so using lambdas doesn't really make sense.
>
> Phil


More information about the PyQt mailing list