[PyQt] properties and interfaces with dip 0.3
Phil Thompson
phil at riverbankcomputing.com
Wed Jul 13 20:49:17 BST 2011
On Wed, 13 Jul 2011 15:17:48 -0400, Lic. José M. Rodriguez Bacallao
<jmrbcu at gmail.com> wrote:
> in this example:
>
> class ITest(Interface):
> id = Str()
>
> @implements(ITest)
> class Test(Model):
>
> @ITest.id.getter
> def id(self):
> return 'getting id'
>
> @ITest.id.setter
> def id(self, v):
> print 'setting id'
>
> @observe('id')
> def on_change(self, change):
> print 'changing...'
>
> test = Test()
> test.id = 'xxx'
> print test.id
>
> in the case of properties, it is necessary to use the syntax:
> @Interface.attr but here I got another problem, the getter are not
> being called. Why?
@id.setter
def id(self, v):
Python properties work in exactly the same way.
Phil
More information about the PyQt
mailing list