Skip to content

ipygame.rect

pygame-compatible Rect and FRect classes.

class Rect()

Stores rectangular coordinates (int).

def __init__(*args)

@property
def x() -> int

@x.setter
def x(v: int) -> None

@property
def y() -> int

@y.setter
def y(v: int) -> None

@property
def w() -> int

@w.setter
def w(v: int) -> None

@property
def h() -> int

@h.setter
def h(v: int) -> None

width = w

height = h

@property
def width() -> int

@width.setter
def width(v: int) -> None

@property
def height() -> int

@height.setter
def height(v: int) -> None

@property
def size() -> tuple[int, int]

@size.setter
def size(v: tuple[int, int]) -> None

@property
def top() -> int

@top.setter
def top(v: int) -> None

@property
def left() -> int

@left.setter
def left(v: int) -> None

@property
def bottom() -> int

@bottom.setter
def bottom(v: int) -> None

@property
def right() -> int

@right.setter
def right(v: int) -> None

@property
def topleft() -> tuple[int, int]

@topleft.setter
def topleft(v: tuple[int, int]) -> None

@property
def topright() -> tuple[int, int]

@topright.setter
def topright(v: tuple[int, int]) -> None

@property
def bottomleft() -> tuple[int, int]

@bottomleft.setter
def bottomleft(v: tuple[int, int]) -> None

@property
def bottomright() -> tuple[int, int]

@bottomright.setter
def bottomright(v: tuple[int, int]) -> None

@property
def centerx() -> int

@centerx.setter
def centerx(v: int) -> None

@property
def centery() -> int

@centery.setter
def centery(v: int) -> None

@property
def center() -> tuple[int, int]

@center.setter
def center(v: tuple[int, int]) -> None

@property
def midtop() -> tuple[int, int]

@midtop.setter
def midtop(v: tuple[int, int]) -> None

@property
def midbottom() -> tuple[int, int]

@midbottom.setter
def midbottom(v: tuple[int, int]) -> None

@property
def midleft() -> tuple[int, int]

@midleft.setter
def midleft(v: tuple[int, int]) -> None

@property
def midright() -> tuple[int, int]

@midright.setter
def midright(v: tuple[int, int]) -> None

def move(x: int, y: int) -> Rect

def move_ip(x: int, y: int) -> None

def move_to(**kwargs) -> Rect

def inflate(x: int, y: int) -> Rect

def inflate_ip(x: int, y: int) -> None

def scale_by(sx: float, sy: float | None = None) -> Rect

def scale_by_ip(sx: float, sy: float | None = None) -> None

def update(*args) -> None

def normalize() -> None

def clamp(other) -> Rect

def clamp_ip(other) -> None

def clip(other) -> Rect

def clipline(*args) -> tuple[tuple[int, int], tuple[int, int]] | tuple[()]

Cohen-Sutherland line clipping.

def union(other) -> Rect

def union_ip(other) -> None

def unionall(others: Sequence) -> Rect

def unionall_ip(others: Sequence) -> None

def fit(other) -> Rect

Scale and center self to fit inside other, preserving aspect ratio.

def contains(other) -> bool

def collidepoint(*args) -> bool

def colliderect(other) -> bool

def collidelist(rects: Sequence) -> int

def collidelistall(rects: Sequence) -> list[int]

def collidedict(d: dict, use_values: bool = True) -> tuple | None

def collidedictall(d: dict, use_values: bool = True) -> list[tuple]

def collideobjects(objects, key=None)

def collideobjectsall(objects, key=None) -> list

def copy() -> Rect

class FRect()

Stores rectangular coordinates (float).

def __init__(*args)

@property
def x() -> float

@x.setter
def x(v) -> None

@property
def y() -> float

@y.setter
def y(v) -> None

@property
def w() -> float

@w.setter
def w(v) -> None

@property
def h() -> float

@h.setter
def h(v) -> None

@property
def width() -> float

@width.setter
def width(v) -> None

@property
def height() -> float

@height.setter
def height(v) -> None

@property
def size() -> tuple[float, float]

@size.setter
def size(v) -> None

@property
def top() -> float

@top.setter
def top(v) -> None

@property
def left() -> float

@left.setter
def left(v) -> None

@property
def bottom() -> float

@bottom.setter
def bottom(v) -> None

@property
def right() -> float

@right.setter
def right(v) -> None

@property
def topleft() -> tuple[float, float]

@topleft.setter
def topleft(v) -> None

@property
def topright() -> tuple[float, float]

@topright.setter
def topright(v) -> None

@property
def bottomleft() -> tuple[float, float]

@bottomleft.setter
def bottomleft(v) -> None

@property
def bottomright() -> tuple[float, float]

@bottomright.setter
def bottomright(v) -> None

@property
def centerx() -> float

@centerx.setter
def centerx(v) -> None

@property
def centery() -> float

@centery.setter
def centery(v) -> None

@property
def center() -> tuple[float, float]

@center.setter
def center(v) -> None

@property
def midtop() -> tuple[float, float]

@midtop.setter
def midtop(v) -> None

@property
def midbottom() -> tuple[float, float]

@midbottom.setter
def midbottom(v) -> None

@property
def midleft() -> tuple[float, float]

@midleft.setter
def midleft(v) -> None

@property
def midright() -> tuple[float, float]

@midright.setter
def midright(v) -> None

def move(x, y) -> FRect

def move_ip(x, y) -> None

def move_to(**kwargs) -> FRect

def inflate(x, y) -> FRect

def inflate_ip(x, y) -> None

def scale_by(sx, sy=None) -> FRect

def scale_by_ip(sx, sy=None) -> None

def update(*args) -> None

def normalize() -> None

def clamp(other) -> FRect

def clamp_ip(other) -> None

def clip(other) -> FRect

def union(other) -> FRect

def union_ip(other) -> None

def unionall(others) -> FRect

def unionall_ip(others) -> None

def fit(other) -> FRect

def contains(other) -> bool

def collidepoint(*args) -> bool

def colliderect(other) -> bool

def collidelist(rects) -> int

def collidelistall(rects) -> list[int]

def copy() -> FRect