Skip to main content

BorderSide

Creates the side of a border.

By default, the border is 1.0 logical pixels wide and solid black color.

To omit (not show) a side, set style to flet.BorderStyle.NONE. It skips painting the border, but the border still has a width.

Properties

  • color - The color of this side of the border.
  • stroke_align - The relative position of the stroke on a BorderSide in an OutlinedBorder or Border.
  • stroke_inset - The amount of the stroke width that lies inside this BorderSide.
  • stroke_offset - The offset of the stroke, taking into account the stroke alignment.
  • stroke_outset - The amount of the stroke width that lies outside this BorderSide.
  • style - The style of this side of the border.
  • width - The width of this side of the border, in logical pixels.

Methods

  • copy - Returns a copy of this object with the specified properties overridden.
  • none - Creates a border side that is not rendered.

Properties

colorclass-attributeinstance-attribute

The color of this side of the border.

stroke_alignclass-attributeinstance-attribute

The relative position of the stroke on a BorderSide in an OutlinedBorder or Border.

stroke_insetproperty

The amount of the stroke width that lies inside this BorderSide.

For example, this will return the width for a stroke_align of -1, half the width for a stroke_align of 0, and 0 for a stroke_align of 1.

stroke_offsetproperty

The offset of the stroke, taking into account the stroke alignment.

For example, this will return the negative width of the stroke for a stroke_align of -1, 0 for a stroke_align of 0, and the width for a stroke_align of -1.

stroke_outsetproperty

The amount of the stroke width that lies outside this BorderSide.

For example, this will return 0 for a stroke_align of -1, half the width for a stroke_align of 0, and the width for a stroke_align of 1.

styleclass-attributeinstance-attribute

The style of this side of the border.

widthclass-attributeinstance-attribute

width: Number = 1.0

The width of this side of the border, in logical pixels.

Setting width to 0.0 will result in a hairline border. This means that the border will have the width of one physical pixel. Hairline rendering takes shortcuts when the path overlaps a pixel more than once. This means that it will render faster than otherwise, but it might double-hit pixels, giving it a slightly darker/lighter result.

Tip

To omit the border entirely, set the style to flet.BorderStyle.NONE.

Raises:

  • ValueError - If it is not greater than or equal to 0.

Methods

copy

copy(width: Optional[Number] = None, color: Optional[ColorValue] = None, stroke_align: Optional[BorderSideStrokeAlignValue] = None)

Returns a copy of this object with the specified properties overridden.

nonestaticmethod

none()

Creates a border side that is not rendered.

Returns: