PositiveNumberProperty

ipkiss3.all.PositiveNumberProperty(internal_member_name=None, restriction=None, default=None, doc=None, locked=False, **kwargs)

DefinitionProperty restricted to be a positive (>0) int or float

See also

ipcore.properties.descriptor.DefinitionProperty, float, int

Examples

>>> import ipkiss3.all as i3
>>> class MyCell(i3.PCell):
...     prop = i3.PositiveNumberProperty(doc="an example PositiveNumberProperty")
...
...     def _default_prop(self):
...          return 0.01
>>> cell = MyCell()
>>> print(cell.prop)
0.0
>>> cell.prop = 1
>>> print(cell.prop)
1
>>> cell.prop = 0 # this will raise an error as 0 is not a positive number