class Screen(object):
@property
def width(self):
return self._width
@width.setter
def width(self,x):
if x < 0 or x> 10000:
raise ValueError('score must between 0 ~ 10000!')
self._width=x
@property
def height(self):
return self._height
@height.setter
def height(self,x):
if x < 0 or x> 1000:
raise ValueError('score must between 0 ~ 1000!')
self._height=x
@property
def resolution(self):
return self._width*self._height
bai渡者
-- coding: utf-8 --
class Screen(object): @property def width(self): return self._width @width.setter def width(self,x): if x < 0 or x> 10000: raise ValueError('score must between 0 ~ 10000!') self._width=x