cushy/examples/button.rs
2023-10-27 10:41:13 -07:00

10 lines
324 B
Rust

use gooey::dynamic::Dynamic;
use gooey::widgets::Button;
use gooey::{EventLoopError, Run};
fn main() -> Result<(), EventLoopError> {
let count = Dynamic::new(0_usize);
Button::new(count.map_each(ToString::to_string))
.on_click(count.with_clone(|count| move |_| count.set(count.get() + 1)))
.run()
}