cushy/examples/button.rs
Jonathan Johnson fc707835f5
Initial commit
2023-10-18 08:22:41 -07:00

11 lines
344 B
Rust

use gooey::dynamic::Dynamic;
use gooey::widget::Widget;
use gooey::widgets::Button;
use gooey::EventLoopError;
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()
}