S or /

SourceClass RectShape

from egui import RectShape
class RectShape:

How to paint a rectangle.

Properties§

@property def angle(self, /) -> float§
@angle.setter def angle(self, /, angle: float) -> None§
@property def blur_width(self, /) -> float§
@blur_width.setter def blur_width(self, /, blur_width: float) -> None§
@property def brush(self, /) -> Brush |None§
@brush.setter def brush(self, /, brush: Brush |None) -> None§
@property def corner_radius(self, /) -> CornerRadius§
@corner_radius.setter def corner_radius(self, /, corner_radius: CornerRadius) -> None§
@property def fill(self, /) -> Color32§
@fill.setter def fill(self, /, fill: Color32) -> None§
@property def rect(self, /) -> Rect§
@rect.setter def rect(self, /, rect: Rect) -> None§
@property def round_to_pixels(self, /) -> bool |None§
@round_to_pixels.setter def round_to_pixels(self, /, round_to_pixels: bool |None) -> None§
@property def stroke_kind(self, /) -> StrokeKind§
@stroke_kind.setter def stroke_kind(self, /, stroke_kind: StrokeKind) -> None§
@property def stroke_value(self, /) -> Stroke§
@stroke_value.setter def stroke_value(self, /, stroke: Stroke) -> None§

Methods§

Sourcedef fill_texture_id(self, /) -> TextureId§

The texture to use when painting this rectangle, if any.

If no texture is set, this will return TextureId.default.

Source@staticmethod def filled(rect: Rect, corner_radius: Any, fill: Color32) -> RectShape§
Source@staticmethod def stroke(rect: Rect, corner_radius: Any, stroke: Stroke, stroke_kind: StrokeKind) -> RectShape§
Sourcedef visual_bounding_rect(self, /) -> Rect§

The visual bounding rectangle (includes stroke width)

Sourcedef with_angle(self, /, angle: float) -> RectShape§

Set the rotation of the rectangle (in radians, clockwise). The rectangle rotates around its center.

Sourcedef with_angle_and_pivot(self, /, angle: float, pivot: Pos2) -> RectShape§

Set the rotation of the rectangle (in radians, clockwise) around a custom pivot point.

Sourcedef with_blur_width(self, /, blur_width: float) -> RectShape§

If larger than zero, the edges of the rectangle (for both fill and stroke) will be blurred.

This can be used to produce shadows and glow effects.

The blur is currently implemented using a simple linear blur in sRGBA gamma space.

Sourcedef with_round_to_pixels(self, /, round_to_pixels: bool) -> RectShape§

Snap the rectangle to pixels?

Rounding produces sharper rectangles.

If None, egui.TessellationOptions.round_rects_to_pixels will be used.

Sourcedef with_stroke_kind(self, /, stroke_kind: StrokeKind) -> RectShape§

Set if the stroke is on the inside, outside, or centered on the rectangle.

Sourcedef with_texture(self, /, fill_texture_id: TextureId, uv: Rect) -> RectShape§

Set the texture to use when painting this rectangle, if any.