Values and Enums

Overview

Align

Alignment on an axis of a container.

Clipboard

A buffer for short-term storage and transfer within and between applications.

FillMode

The fill mode of a rule.

HorizontalAlignment

The horizontal alignment of some resource.

ImageHandle

An pyiced.image() handle.

Instant()

A measurement of a monotonically nondecreasing clock.

Length

The strategy used to fill space in a specific dimension.

Line(color, width)

A line.

Point(x, y)

A 2D point.

Rectangle(top_left, size)

A rectangle.

Size(width, height)

An amount of space in 2 dimensions.

SliderHandle(proto, **kwargs)

The appearance of the handle of a slider.

SliderHandleShape

The shape of the handle of a slider.

SvgHandle

An svg() handle.

TextInputCursor(state)

A representation of cursor position in a text_input().

TooltipPosition

The position of the tooltip.

VerticalAlignment

The vertical alignment of some resource.

Details

class pyiced.Align

Alignment on an axis of a container.

See also

iced::Align

START

Align at the start of the axis.

CENTER

Align at the center of the axis.

END

Align at the end of the axis.

class pyiced.Clipboard

A buffer for short-term storage and transfer within and between applications.

Warning

The clipboard is only valid during the call to pyiced.IcedApp.update().

See also

iced::Clipboard

read()

Reads the current content of the clipboard as text.

Returns

The current contents of the clipboard.

Return type

Optional[str]

write(value)

Writes the given text contents to the clipboard.

Parameters

value (str) – The new contents of the clipboard.

class pyiced.FillMode

The fill mode of a rule.

FULL = FillMode.FULL
static asymmetric_padding(first_pad, second_pad)

Different offset on each end of the rule.

Parameters
  • first_pad (int) – top or left, length units

  • second_pad (int) – the other direction, length units

static padded(i)

Uniform offset from each end.

Parameters

i (int) – Length units.

static percent(percentage)

Fill a percent of the length of the container. The rule will be centered in that container.

Parameters

percentage (float) – The range is [0.0, 100.0]. The value gets clamped in this range automatically.

class pyiced.HorizontalAlignment

The horizontal alignment of some resource.

LEFT

Align left

CENTER

Horizontally centered

RIGHT

Align right

class pyiced.ImageHandle

An pyiced.image() handle.

static from_memory(bytes)

Creates an image handle containing the image data directly.

Parameters

bytes (bytes-like) – The data of the image file.

Returns

The new image handle.

Return type

ImageHandle

static from_path(path)

Creates an image handle pointing to the image of the given path.

Parameters

path (pathlib.Path) – The path of the image file.

Returns

The new image handle.

Return type

ImageHandle

class pyiced.Instant

A measurement of a monotonically nondecreasing clock. Opaque and useful only with duration.

  • You can add/substract a number of seconds as float to/from an instant to get a new instant.

  • You can add/substract a timedelta to/from an instant to get a new instant.

  • You can substract two instants to get the number of seconds as float between them: later - earlier = seconds.

class pyiced.Length

The strategy used to fill space in a specific dimension.

See also

iced::Length

FILL = Length.FILL
SHRINK = Length.SHRINK
static fill_portion(i)

Fill a portion of the remaining space relative to other elements.

static units(i)

Fill a fixed amount of space.

class pyiced.Line(color, width)

A line.

It is normally used to define the highlight of something, like a split.

Parameters
  • color (Color) – The color of the line.

  • width (float) – The width of the line.

color

The color of the line.

Returns

The “color” parameter given when constructing this line.

Return type

Color

width

The width of the line.

Returns

The “width” parameter given when constructing this line.

Return type

float

class pyiced.Point(x, y)

A 2D point.

Parameters
  • x (float) – The X coordinate.

  • y (float) – The Y coordinate.

See also

iced::Point

ORIGIN = Point(0, 0)
distance(to)

Computes the distance to another point.

Parameters

to (Point) – The other point.

x

The X coordinate.

Returns

The “x” parameter given when constructing this point.

Return type

float

y

The Y coordinate.

Returns

The “y” parameter given when constructing this point.

Return type

float

class pyiced.Rectangle(top_left, size)

A rectangle.

See also

iced::Rectangle

Parameters
  • top_left (Point) – The top-left corner.

  • size (Size) – The size of the rectangle.

height

Height of the rectangle.

Returns

The “size.height” parameter given when constructing this point.

Return type

float

size

The size of the rectangle.

Returns

The “size” parameter given when constructing this point.

Return type

Size

top_left

The top-left corner.

Returns

The “top_left” parameter given when constructing this point.

Return type

Point

width

Width of the rectangle.

Returns

The “size.width” parameter given when constructing this point.

Return type

float

static with_size(size)

Creates a new Rectangle with its top-left corner at the origin and with the provided Size.

Parameters

size (Size) – Size of the new Rectangle

Returns

The new Rectangle.

Return type

Rectangle

x

X coordinate of the top-left corner.

Returns

The “top_left.x” parameter given when constructing this point.

Return type

float

y

Y coordinate of the top-left corner.

Returns

The “top_left.y” parameter given when constructing this point.

Return type

float

class pyiced.Size(width, height)

An amount of space in 2 dimensions.

Parameters
  • width (float) – The width.

  • height (float) – The height.

See also

iced::Size

INFINITY = Size(inf, inf)
UNIT = Size(1.0, 1.0)
ZERO = Size(0.0, 0.0)
height

The height.

Returns

The “height” parameter given when constructing this size.

Return type

float

pad(padding)

Increments the Size to account for the given padding.

Parameters

padding (float) – The other size.

width

The width.

Returns

The “width” parameter given when constructing this size.

Return type

float

class pyiced.SliderHandle(proto, **kwargs)

The appearance of the handle of a slider.

Parameters
  • proto (Optional[Union[SliderHandle, str]]) –

    Source style sheet to clone and modify. Defaults to iced_style’s default style.

    The valid string values are “active”, “hovered” and “dragging”, same as the argument for SliderStyleSheet.

    None is the same as “active”.

  • shape (SliderHandleShape) – The color of the slider_handle.

  • color (Color) – The width of the slider_handle.

  • border_width (float) – The width of the slider_handle.

  • border_color (Color) – The width of the slider_handle.

border_color

The “border_color” parameter given to the constructor.

Returns

The set, copied or defaulted value.

Return type

Color

border_width

The “border_width” parameter given to the constructor.

Returns

The set, copied or defaulted value.

Return type

float

color

The “color” parameter given to the constructor.

Returns

The set, copied or defaulted value.

Return type

Color

shape()
class pyiced.SliderHandleShape

The shape of the handle of a slider.

static circle(radius)

A circle.

Parameters

radius (float) – The radius of the circle

Returns

A slider handle in the shape of a circle.

Return type

SliderHandleShape

static rectangle(width, border_radius)

A rectangle.

Parameters
  • width (int) – The length of an edge.

  • border_radius (float) – The border radius.

Returns

A slider handle in the shape of a rectangle.

Return type

SliderHandleShape

class pyiced.SvgHandle

An svg() handle.

static from_memory(bytes)

Creates an SVG handle containing the image data directly.

Parameters

bytes (bytes-like) –

Creates an SVG Handle from raw bytes containing either an SVG string or gzip compressed data.

This is useful if you already have your SVG data in-memory, maybe because you downloaded or generated it procedurally.

Returns

An SVG handle usable in svg().

Return type

SvgHandle

static from_path(path)

Creates an SVG Handle pointing to the vector image of the given path.

Parameters

path (path-like) – Creates an SVG Handle pointing to the vector image of the given path.

Returns

An SVG handle usable in svg().

Return type

SvgHandle

class pyiced.TextInputCursor(state)

A representation of cursor position in a text_input().

There should be no reason to create or inspect this object directly.

Parameters

state (TextInputState) – Text input state to inspect.

selection(value)

Get the selected text.

Warning

If the state is currently in use, the method will fail.

Parameters

value (str) – The current value of the text_input().

Returns

The selected text. May be empty.

Return type

str

state(value)

Get the state of the TextInputCursor().

The result is measured in terms of graphems, not bytes or codepoints!

Warning

If the state is currently in use, the method will fail.

Returns

  • int – The current cursor position when there’s no selection.

  • Tuple[int, int] – The selected text range.

class pyiced.TooltipPosition

The position of the tooltip.

FOLLOW_CURSOR

The tooltip will follow the cursor.

TOP

The tooltip will appear on the top of the widget.

BOTTOM

The tooltip will appear on the bottom of the widget.

LEFT

The tooltip will appear on the left of the widget.

RIGHT

The tooltip will appear on the right of the widget.

class pyiced.VerticalAlignment

The vertical alignment of some resource.

TOP

Align top

CENTER

Vertically centered

BOTTOM

Align bottom