Module rstk::button

source ·
Expand description

Button widget - displays text/image. Executes a command when clicked.

Examples

The simplest button has some text and a command:

let button_1 = rstk::make_button(&root);
button_1.text("Button text");
button_1.command(|| { println!("Clicked button_1"); });

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

let button_3 = rstk::make_button(&root);
button_3.image(&read_image("tcllogo.gif"));
button_3.text("Tcl Logo");
button_3.command(|| { println!("Clicked button_3"); });
button_3.compound(rstk::Compound::Bottom);

Structs

Functions

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