📄 _core.py
字号:
def SetX(*args, **kwargs):
"""SetX(self, int x)"""
return _core_.Rect_SetX(*args, **kwargs)
def GetY(*args, **kwargs):
"""GetY(self) -> int"""
return _core_.Rect_GetY(*args, **kwargs)
def SetY(*args, **kwargs):
"""SetY(self, int y)"""
return _core_.Rect_SetY(*args, **kwargs)
def GetWidth(*args, **kwargs):
"""GetWidth(self) -> int"""
return _core_.Rect_GetWidth(*args, **kwargs)
def SetWidth(*args, **kwargs):
"""SetWidth(self, int w)"""
return _core_.Rect_SetWidth(*args, **kwargs)
def GetHeight(*args, **kwargs):
"""GetHeight(self) -> int"""
return _core_.Rect_GetHeight(*args, **kwargs)
def SetHeight(*args, **kwargs):
"""SetHeight(self, int h)"""
return _core_.Rect_SetHeight(*args, **kwargs)
def GetPosition(*args, **kwargs):
"""GetPosition(self) -> Point"""
return _core_.Rect_GetPosition(*args, **kwargs)
def SetPosition(*args, **kwargs):
"""SetPosition(self, Point p)"""
return _core_.Rect_SetPosition(*args, **kwargs)
def GetSize(*args, **kwargs):
"""GetSize(self) -> Size"""
return _core_.Rect_GetSize(*args, **kwargs)
def SetSize(*args, **kwargs):
"""SetSize(self, Size s)"""
return _core_.Rect_SetSize(*args, **kwargs)
def IsEmpty(*args, **kwargs):
"""IsEmpty(self) -> bool"""
return _core_.Rect_IsEmpty(*args, **kwargs)
def GetTopLeft(*args, **kwargs):
"""GetTopLeft(self) -> Point"""
return _core_.Rect_GetTopLeft(*args, **kwargs)
def SetTopLeft(*args, **kwargs):
"""SetTopLeft(self, Point p)"""
return _core_.Rect_SetTopLeft(*args, **kwargs)
def GetBottomRight(*args, **kwargs):
"""GetBottomRight(self) -> Point"""
return _core_.Rect_GetBottomRight(*args, **kwargs)
def SetBottomRight(*args, **kwargs):
"""SetBottomRight(self, Point p)"""
return _core_.Rect_SetBottomRight(*args, **kwargs)
def GetLeft(*args, **kwargs):
"""GetLeft(self) -> int"""
return _core_.Rect_GetLeft(*args, **kwargs)
def GetTop(*args, **kwargs):
"""GetTop(self) -> int"""
return _core_.Rect_GetTop(*args, **kwargs)
def GetBottom(*args, **kwargs):
"""GetBottom(self) -> int"""
return _core_.Rect_GetBottom(*args, **kwargs)
def GetRight(*args, **kwargs):
"""GetRight(self) -> int"""
return _core_.Rect_GetRight(*args, **kwargs)
def SetLeft(*args, **kwargs):
"""SetLeft(self, int left)"""
return _core_.Rect_SetLeft(*args, **kwargs)
def SetRight(*args, **kwargs):
"""SetRight(self, int right)"""
return _core_.Rect_SetRight(*args, **kwargs)
def SetTop(*args, **kwargs):
"""SetTop(self, int top)"""
return _core_.Rect_SetTop(*args, **kwargs)
def SetBottom(*args, **kwargs):
"""SetBottom(self, int bottom)"""
return _core_.Rect_SetBottom(*args, **kwargs)
position = property(GetPosition, SetPosition)
size = property(GetSize, SetSize)
left = property(GetLeft, SetLeft)
right = property(GetRight, SetRight)
top = property(GetTop, SetTop)
bottom = property(GetBottom, SetBottom)
def Inflate(*args, **kwargs):
"""
Inflate(self, int dx, int dy) -> Rect
Increases the size of the rectangle.
The left border is moved farther left and the right border is moved
farther right by ``dx``. The upper border is moved farther up and the
bottom border is moved farther down by ``dy``. (Note the the width and
height of the rectangle thus change by ``2*dx`` and ``2*dy``,
respectively.) If one or both of ``dx`` and ``dy`` are negative, the
opposite happens: the rectangle size decreases in the respective
direction.
The change is made to the rectangle inplace, if instead you need a
copy that is inflated, preserving the original then make the copy
first::
copy = wx.Rect(*original)
copy.Inflate(10,15)
"""
return _core_.Rect_Inflate(*args, **kwargs)
def Deflate(*args, **kwargs):
"""
Deflate(self, int dx, int dy) -> Rect
Decrease the rectangle size. This method is the opposite of `Inflate`
in that Deflate(a,b) is equivalent to Inflate(-a,-b). Please refer to
`Inflate` for a full description.
"""
return _core_.Rect_Deflate(*args, **kwargs)
def OffsetXY(*args, **kwargs):
"""
OffsetXY(self, int dx, int dy)
Moves the rectangle by the specified offset. If dx is positive, the
rectangle is moved to the right, if dy is positive, it is moved to the
bottom, otherwise it is moved to the left or top respectively.
"""
return _core_.Rect_OffsetXY(*args, **kwargs)
def Offset(*args, **kwargs):
"""
Offset(self, Point pt)
Same as `OffsetXY` but uses dx,dy from Point
"""
return _core_.Rect_Offset(*args, **kwargs)
def Intersect(*args, **kwargs):
"""
Intersect(self, Rect rect) -> Rect
Returns the intersectsion of this rectangle and rect.
"""
return _core_.Rect_Intersect(*args, **kwargs)
def Union(*args, **kwargs):
"""
Union(self, Rect rect) -> Rect
Returns the union of this rectangle and rect.
"""
return _core_.Rect_Union(*args, **kwargs)
def __add__(*args, **kwargs):
"""
__add__(self, Rect rect) -> Rect
Add the properties of rect to this rectangle and return the result.
"""
return _core_.Rect___add__(*args, **kwargs)
def __iadd__(*args, **kwargs):
"""
__iadd__(self, Rect rect) -> Rect
Add the properties of rect to this rectangle, updating this rectangle.
"""
return _core_.Rect___iadd__(*args, **kwargs)
def __eq__(*args, **kwargs):
"""
__eq__(self, PyObject other) -> bool
Test for equality of wx.Rect objects.
"""
return _core_.Rect___eq__(*args, **kwargs)
def __ne__(*args, **kwargs):
"""
__ne__(self, PyObject other) -> bool
Test for inequality of wx.Rect objects.
"""
return _core_.Rect___ne__(*args, **kwargs)
def InsideXY(*args, **kwargs):
"""
InsideXY(self, int x, int y) -> bool
Return True if the point is (not strcitly) inside the rect.
"""
return _core_.Rect_InsideXY(*args, **kwargs)
def Inside(*args, **kwargs):
"""
Inside(self, Point pt) -> bool
Return True if the point is (not strcitly) inside the rect.
"""
return _core_.Rect_Inside(*args, **kwargs)
def Intersects(*args, **kwargs):
"""
Intersects(self, Rect rect) -> bool
Returns True if the rectangles have a non empty intersection.
"""
return _core_.Rect_Intersects(*args, **kwargs)
def CenterIn(*args, **kwargs):
"""
CenterIn(self, Rect r, int dir=BOTH) -> Rect
Center this rectangle within the one passed to the method, which is
usually, but not necessarily, the larger one.
"""
return _core_.Rect_CenterIn(*args, **kwargs)
CentreIn = CenterIn
x = property(_core_.Rect_x_get, _core_.Rect_x_set)
y = property(_core_.Rect_y_get, _core_.Rect_y_set)
width = property(_core_.Rect_width_get, _core_.Rect_width_set)
height = property(_core_.Rect_height_get, _core_.Rect_height_set)
def Set(*args, **kwargs):
"""
Set(self, int x=0, int y=0, int width=0, int height=0)
Set all rectangle properties.
"""
return _core_.Rect_Set(*args, **kwargs)
def Get(*args, **kwargs):
"""
Get() -> (x,y,width,height)
Return the rectangle properties as a tuple.
"""
return _core_.Rect_Get(*args, **kwargs)
asTuple = wx._deprecated(Get, "asTuple is deprecated, use `Get` instead")
def __str__(self): return str(self.Get())
def __repr__(self): return 'wx.Rect'+str(self.Get())
def __len__(self): return len(self.Get())
def __getitem__(self, index): return self.Get()[index]
def __setitem__(self, index, val):
if index == 0: self.x = val
elif index == 1: self.y = val
elif index == 2: self.width = val
elif index == 3: self.height = val
else: raise IndexError
def __nonzero__(self): return self.Get() != (0,0,0,0)
__safe_for_unpickling__ = True
def __reduce__(self): return (wx.Rect, self.Get())
_core_.Rect_swigregister(Rect)
def RectPP(*args, **kwargs):
"""
RectPP(Point topLeft, Point bottomRight) -> Rect
Create a new Rect object from Points representing two corners.
"""
val = _core_.new_RectPP(*args, **kwargs)
return val
def RectPS(*args, **kwargs):
"""
RectPS(Point pos, Size size) -> Rect
Create a new Rect from a position and size.
"""
val = _core_.new_RectPS(*args, **kwargs)
return val
def RectS(*args, **kwargs):
"""
RectS(Size size) -> Rect
Create a new Rect from a size only.
"""
val = _core_.new_RectS(*args, **kwargs)
return val
def IntersectRect(*args, **kwargs):
"""
IntersectRect(Rect r1, Rect r2) -> Rect
Calculate and return the intersection of r1 and r2.
"""
return _core_.IntersectRect(*args, **kwargs)
#---------------------------------------------------------------------------
class Point2D(object):
"""
wx.Point2Ds represent a point or a vector in a 2d coordinate system
with floating point values.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, *args, **kwargs):
"""
__init__(self, double x=0.0, double y=0.0) -> Point2D
Create a w.Point2D object.
"""
_core_.Point2D_swiginit(self,_core_.new_Point2D(*args, **kwargs))
def GetFloor(*args, **kwargs):
"""
GetFloor() -> (x,y)
Convert to integer
"""
return _core_.Point2D_GetFloor(*args, **kwargs)
def GetRounded(*args, **kwargs):
"""
GetRounded() -> (x,y)
Convert to integer
"""
return _core_.Point2D_GetRounded(*args, **kwargs)
def GetVectorLength(*args, **kwargs):
"""GetVectorLength(self) -> double"""
return _core_.Point2D_GetVectorLength(*args, **kwargs)
def GetVectorAngle(*args, **kwargs):
"""GetVectorAngle(self) -> double"""
return _core_.Point2D_GetVectorAngle(*args, **kwargs)
def SetVectorLength(*args, **kwargs):
"""SetVectorLength(self, double length)"""
return _core_.Point2D_SetVectorLength(*args, **kwargs)
def SetVectorAngle(*args, **kwargs):
"""SetVectorAngle(self, double degrees)"""
return _core_.Point2D_SetVectorAngle(*args, **kwargs)
def SetPolarCoordinates(self, angle, length):
self.SetVectorLength(length)
self.SetVectorAngle(angle)
def Normalize(self):
self.SetVectorLength(1.0)
def GetDistance(*args, **kwargs):
"""GetDistance(self, Point2D pt) -> double"""
return _core_.Point2D_GetDistance(*args, **kwargs)
def GetDistanceSquare(*args, **kwargs):
"""GetDistanceSquare(self, Point2D pt) -> double"""
return _core_.Point2D_GetDistanceSquare(*args, **kwargs)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -