Module rstk::label

source ·
Expand description

Label widgets - displays text/image.

Examples

The simplest label has some text:

let label_1 = rstk::make_label(&root);
label_1.text("Label text");

Labels can also display images, with or without text, and how these are displayed can be controlled using compound. In the following example, a label with both an image and text is set to show the image below the text:

let label_3 = rstk::make_label(&root);
label_3.image(&read_image("tcllogo.gif"));
label_3.text("Tcl Logo");
label_3.compound(rstk::Compound::Bottom);

Labels can also show multi-line text. For this, specify a wrap-length (in pixels):

let label_7 = rstk::make_label(&root);
label_7.wrap_length(300);
label_7.text("Rust has great documentation, a friendly compiler with useful error messages, and
top-notch tooling - an integrated package manager and build tool, smart multi-editor support
with auto-completion and type inspections, an auto-formatter, and more. --
https://rust-lang.org");

Structs

Functions

  • Creates an instance of a label widget in given parent.