Re: Supporting attribute-like properties
- From: Simon Feltman <s feltman gmail com>
- To: Kerrick Staley <mail kerrickstaley com>
- Cc: python-hackers-list gnome org
- Subject: Re: Supporting attribute-like properties
- Date: Fri, 25 May 2012 23:50:14 -0700
Hi Kerrick,
Properties on classes and objects pulled in through introspection have a "props" accessor. So with your example but using myLabel.props.angle should already work.
If the GObject property was created in python, then the property will be directly accessible on the object as well (GObject.Property supports the descriptor and decoration protocols similar pythons built-in "property")
from gi.repository import GObject
class Label(GObject.GObject):
angle = GObject.Property(type=float)
myLabel = Label()
myLabel.angle = myLabel.angle + 180
-Simon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]