Skip to content

Ported from iced

iced is the Rust GUI library that yugui draws with. Its repository has an example for each of its features; these are some of them, rewritten in Python. Each one says what it leaves out, if anything.

Bezier tool

draw quadratic Bézier curves with three clicks each. Click where a curve starts, then where it ends, then move the pointer to bend it and click again. The curve being drawn follows the pointer.

Source: examples/iced/bezier_tool.py

Bezier tool

Checkbox

the default checkbox enables four styled ones. iced's version also shows a checkbox with a custom icon font, which yugui can't load yet, so it is left out.

Source: examples/iced/checkbox.py

Checkbox

Clock

an analogue clock drawn on a canvas, growing with the window. The theme changes every ten seconds, and its name is shown on the face.

Source: examples/iced/clock.py

Clock

Combo box

type to narrow down a list of languages, and be greeted in

Source: examples/iced/combo_box.py

Combo box

Layout

one page per layout idea (centering, rows, columns, space, pins). The arrow keys, or the buttons, go from page to page; "Explain" outlines every widget's bounds.

Source: examples/iced/layout.py

Layout

a sign-up form over the page; Escape or a click outside closes it. Tab and Shift+Tab move the focus between the form's fields: iced leaves Tab to the app, which answers with ui.focus_next and ui.focus_previous tasks. iced's version listens to the keyboard for Tab and Escape; here ui.shortcuts maps Tab while the form is shown, and ui.modal closes on Escape by itself.

Source: examples/iced/modal.py

Pick list

choose a language from a drop-down, in a long scrolling page.

Source: examples/iced/pick_list.py

Pick list

Progress bar

a bar that follows a slider, horizontal or vertical.

Source: examples/iced/progress_bar.py

Progress bar

Scrollable

scrolling down, across or both ways, with a tunable scrollbar. The sliders size the scrollbar, the radios pick the direction and the end the scrollable starts from, the buttons jump to either end, and the bars under it follow the scroll position.

Source: examples/iced/scrollable.py

Scrollable

Slider

a vertical and a horizontal slider sharing one value. Shift moves them by 5; a ctrl-click (cmd-click on macOS) resets them to 50.

Source: examples/iced/slider.py

Slider

Stopwatch

start, stop and reset, from buttons or the keyboard. Space starts and stops, R resets. The 10 ms tick runs only while the stopwatch does.

Source: examples/iced/stopwatch.py

Stopwatch

Styling

every basic widget under any of iced's themes. Arrow keys step through the themes, Space goes back to the system theme.

Source: examples/iced/styling.py

Styling

Toast

short notices that stack in a corner and go away by themselves. Each toast closes after the timeout chosen with the slider, or with its X button. iced draws them with a widget of its own; here they are a column in a ui.stack layer over the page, and a one-second tick removes the expired ones.

Source: examples/iced/toast.py

Toast

Tooltip

a tooltip whose position changes on each press, with a delay.

Source: examples/iced/tooltip.py

Tooltip

Tour

a guided walk through the basic widgets, one screen at a time. Some screens wait for an answer before Next appears: pick the language iced is written in, flip the toggler, type something.

Source: examples/iced/tour.py

Tour