PositiveNumberProperty

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

DefinitionProperty restricted to be a positive (>0) int or float. Any int assigned to this property will get converted to a float.

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.01
>>> cell.prop = 1
>>> print(cell.prop)
1.0
>>> cell.prop = 0 # this will raise an error as 0 is not a positive number