S or /

SourceClass Margin

from egui import Margin
class Margin:

A value for all four sides of a rectangle, often used to express padding or spacing.

Can be added and subtracted to/from Rects.

Negative margins are possible, but may produce weird behavior. Use with care.

All values are stored as int to keep the size of Margin small. If you want floats, use egui.MarginF32 instead.

Properties§

@property def bottom(self, /) -> int§
@bottom.setter def bottom(self, /, bottom: int) -> None§
@property def left(self, /) -> int§
@left.setter def left(self, /, left: int) -> None§
@property def right(self, /) -> int§
@right.setter def right(self, /, right: int) -> None§
@property def top(self, /) -> int§
@top.setter def top(self, /, top: int) -> None§

Methods§

Sourcedef bottomf(self, /) -> float§

Bottom margin, as float

Sourcedef is_same(self, /) -> bool§

Are the margin on every side the same?

Sourcedef left_top(self, /) -> Vec2§
Sourcedef leftf(self, /) -> float§

Left margin, as float

Sourcedef right_bottom(self, /) -> Vec2§
Sourcedef rightf(self, /) -> float§

Right margin, as float

Source@staticmethod def same(margin: int) -> Margin§

The same margin on every side.

Sourcedef sum(self, /) -> Vec2§

Total margins on both sides

Source@staticmethod def symmetric(x: int, y: int) -> Margin§

Margins with the same size on opposing sides

Sourcedef topf(self, /) -> float§

Top margin, as float

@staticmethod def zero() -> Margin§