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.

Color(r, g, b[, a])

A color in the sRGB color space.

FillMode

The fill mode of a rule.

Font(name, data)

A font.

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(shape, color, border_width, ...)

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.Color(r, g, b, a=1.0)

A color in the sRGB color space.

Parameters
  • r (float) – Red component, 0.0 – 1.0

  • g (float) – Green component, 0.0 – 1.0

  • b (float) – Blue component, 0.0 – 1.0

  • a (float) – Alpha channel, 0.0 – 1.0 (0.0 = transparent; 1.0 = opaque)

BLACK = Color(0, 0, 0)
TRANSPARENT = Color(0, 0, 0, a=0)
WHITE = Color(1, 1, 1)
a

Alpha channel, 0.0 – 1.0 (0.0 = transparent; 1.0 = opaque)

Returns

Color channel value

Return type

float

b

Blue component, 0.0 – 1.0

Returns

Color channel value

Return type

float

g

Green component, 0.0 – 1.0

Returns

Color channel value

Return type

float

r

Red component, 0.0 – 1.0

Returns

Color channel value

Return type

float

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.Font(name, data)

A font.

The font does not get loaded multiple times, but instead the name is used to tell fonts apart. So you should use the same name for the same data in subsequent Font instance creations.

Parameters
  • name (str) – The name of the external font

  • data (bytes-like) – The bytes of the external font

See also

iced::Font

Warning

The font data gets interned! Even of the module is unloaded / reloaded, some memory is lost until the interpreter is restarted.

DEFAULT = Font.DEFAULT
data

Bytes data of the font

Returns

  • memoryview – The bytes data of the font.

  • None – For DEFAULT.

name

Name of the font

Returns

  • str – The name of the font.

  • None – For DEFAULT.

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(shape, color, border_width, border_color)

The appearance of the handle of a slider.

Parameters
  • 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.

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 (float) – 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 pointing to the vector image of the given path.

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

Named Colors

pyiced.css_color exports pyiced.Color constants for all 148 named CSS Color Module Level 4 colors.

pyiced.css_color.ALICEBLUE
pyiced.css_color.ANTIQUEWHITE
pyiced.css_color.AQUA
pyiced.css_color.AQUAMARINE
pyiced.css_color.AZURE
pyiced.css_color.BEIGE
pyiced.css_color.BISQUE
pyiced.css_color.BLACK
pyiced.css_color.BLANCHEDALMOND
pyiced.css_color.BLUE
pyiced.css_color.BLUEVIOLET
pyiced.css_color.BROWN
pyiced.css_color.BURLYWOOD
pyiced.css_color.CADETBLUE
pyiced.css_color.CHARTREUSE
pyiced.css_color.CHOCOLATE
pyiced.css_color.CORAL
pyiced.css_color.CORNFLOWERBLUE
pyiced.css_color.CORNSILK
pyiced.css_color.CRIMSON
pyiced.css_color.CYAN
pyiced.css_color.DARKBLUE
pyiced.css_color.DARKCYAN
pyiced.css_color.DARKGOLDENROD
pyiced.css_color.DARKGRAY
pyiced.css_color.DARKGREEN
pyiced.css_color.DARKGREY
pyiced.css_color.DARKKHAKI
pyiced.css_color.DARKMAGENTA
pyiced.css_color.DARKOLIVEGREEN
pyiced.css_color.DARKORANGE
pyiced.css_color.DARKORCHID
pyiced.css_color.DARKRED
pyiced.css_color.DARKSALMON
pyiced.css_color.DARKSEAGREEN
pyiced.css_color.DARKSLATEBLUE
pyiced.css_color.DARKSLATEGRAY
pyiced.css_color.DARKSLATEGREY
pyiced.css_color.DARKTURQUOISE
pyiced.css_color.DARKVIOLET
pyiced.css_color.DEEPPINK
pyiced.css_color.DEEPSKYBLUE
pyiced.css_color.DIMGRAY
pyiced.css_color.DIMGREY
pyiced.css_color.DODGERBLUE
pyiced.css_color.FIREBRICK
pyiced.css_color.FLORALWHITE
pyiced.css_color.FORESTGREEN
pyiced.css_color.FUCHSIA
pyiced.css_color.GAINSBORO
pyiced.css_color.GHOSTWHITE
pyiced.css_color.GOLD
pyiced.css_color.GOLDENROD
pyiced.css_color.GRAY
pyiced.css_color.GREEN
pyiced.css_color.GREENYELLOW
pyiced.css_color.GREY
pyiced.css_color.HONEYDEW
pyiced.css_color.HOTPINK
pyiced.css_color.INDIANRED
pyiced.css_color.INDIGO
pyiced.css_color.IVORY
pyiced.css_color.KHAKI
pyiced.css_color.LAVENDER
pyiced.css_color.LAVENDERBLUSH
pyiced.css_color.LAWNGREEN
pyiced.css_color.LEMONCHIFFON
pyiced.css_color.LIGHTBLUE
pyiced.css_color.LIGHTCORAL
pyiced.css_color.LIGHTCYAN
pyiced.css_color.LIGHTGOLDENRODYELLOW
pyiced.css_color.LIGHTGRAY
pyiced.css_color.LIGHTGREEN
pyiced.css_color.LIGHTGREY
pyiced.css_color.LIGHTPINK
pyiced.css_color.LIGHTSALMON
pyiced.css_color.LIGHTSEAGREEN
pyiced.css_color.LIGHTSKYBLUE
pyiced.css_color.LIGHTSLATEGRAY
pyiced.css_color.LIGHTSLATEGREY
pyiced.css_color.LIGHTSTEELBLUE
pyiced.css_color.LIGHTYELLOW
pyiced.css_color.LIME
pyiced.css_color.LIMEGREEN
pyiced.css_color.LINEN
pyiced.css_color.MAGENTA
pyiced.css_color.MAROON
pyiced.css_color.MEDIUMAQUAMARINE
pyiced.css_color.MEDIUMBLUE
pyiced.css_color.MEDIUMORCHID
pyiced.css_color.MEDIUMPURPLE
pyiced.css_color.MEDIUMSEAGREEN
pyiced.css_color.MEDIUMSLATEBLUE
pyiced.css_color.MEDIUMSPRINGGREEN
pyiced.css_color.MEDIUMTURQUOISE
pyiced.css_color.MEDIUMVIOLETRED
pyiced.css_color.MIDNIGHTBLUE
pyiced.css_color.MINTCREAM
pyiced.css_color.MISTYROSE
pyiced.css_color.MOCCASIN
pyiced.css_color.NAVAJOWHITE
pyiced.css_color.NAVY
pyiced.css_color.OLDLACE
pyiced.css_color.OLIVE
pyiced.css_color.OLIVEDRAB
pyiced.css_color.ORANGE
pyiced.css_color.ORANGERED
pyiced.css_color.ORCHID
pyiced.css_color.PALEGOLDENROD
pyiced.css_color.PALEGREEN
pyiced.css_color.PALETURQUOISE
pyiced.css_color.PALEVIOLETRED
pyiced.css_color.PAPAYAWHIP
pyiced.css_color.PEACHPUFF
pyiced.css_color.PERU
pyiced.css_color.PINK
pyiced.css_color.PLUM
pyiced.css_color.POWDERBLUE
pyiced.css_color.PURPLE
pyiced.css_color.REBECCAPURPLE
pyiced.css_color.RED
pyiced.css_color.ROSYBROWN
pyiced.css_color.ROYALBLUE
pyiced.css_color.SADDLEBROWN
pyiced.css_color.SALMON
pyiced.css_color.SANDYBROWN
pyiced.css_color.SEAGREEN
pyiced.css_color.SEASHELL
pyiced.css_color.SIENNA
pyiced.css_color.SILVER
pyiced.css_color.SKYBLUE
pyiced.css_color.SLATEBLUE
pyiced.css_color.SLATEGRAY
pyiced.css_color.SLATEGREY
pyiced.css_color.SNOW
pyiced.css_color.SPRINGGREEN
pyiced.css_color.STEELBLUE
pyiced.css_color.TAN
pyiced.css_color.TEAL
pyiced.css_color.THISTLE
pyiced.css_color.TOMATO
pyiced.css_color.TURQUOISE
pyiced.css_color.VIOLET
pyiced.css_color.WHEAT
pyiced.css_color.WHITE
pyiced.css_color.WHITESMOKE
pyiced.css_color.YELLOW
pyiced.css_color.YELLOWGREEN