| Crates.io | rusty_gui |
| lib.rs | rusty_gui |
| version | 0.1.4 |
| created_at | 2024-11-30 07:16:28.073759+00 |
| updated_at | 2025-01-05 10:18:19.67722+00 |
| description | This is a simple GUI library for Rust. |
| homepage | |
| repository | https://github.com/Anglebase/Rusty_GUI.git |
| max_upload_size | |
| id | 1466370 |
| size | 136,923 |
rusty_gui aims to create a low entry threshold Rust GUI framework. It mostly uses a simplified API style, making it more intuitive and simple to use. It is very friendly to Rust's beginners, and you can even learn some programming ideas in Rust that are different from other languages through it. It also can help beginners write graphical programs to enhance their skills.
rusty_gui is designed to be easy to use for beginners. It uses a simplified API style, making it more intuitive and simple to use.rusty_gui is designed to be easy to learn and use. It is very friendly to Rust's beginners, and you can even learn some programming ideas in Rust that are different from other languages through it.rusty_gui is designed to be customizable. You can easily create your own widgets, themes, and other components to fit your needs.To use rusty_gui, add the following to your Cargo.toml file:
[dependencies]
rusty_gui = "0.1"
Or use the following command to add it to your project:
cargo add rusty_gui
Here is a simple demo of rusty_gui:
use rusty_gui::*;
struct MyWindow {
this: Window,
content: String,
}
default_as_window!(MyWindow);
impl Drawable for MyWindow {
fn draw(&mut self, canvas: &mut Canvas) {
canvas.clear(Color::WHITE);
let style = FontStyle {
size: 24,
..FontStyle::default()
};
canvas.set_font(&Font::new(style));
canvas.rect_text(self.this.rect(), &self.content, TextAlign::Center);
}
}
impl EventListener for MyWindow {
fn on_event(&mut self, event: &Event) {
let _ = event;
}
}
impl MyWindow {
fn new(content: &str) -> Self {
Self {
this: Window::default(),
content: String::from(content),
}
}
fn create(content: &str, rect: Rect) -> Widget<Self> {
let mut ret = Widget::new(Self::new(content));
ret.this = Window::new("MyWindow", rect, None, &ret);
ret
}
}
fn main() {
let app = Application::new(true);
let window = MyWindow::create("Hello, This is Rusty GUI!", rect!(50, 50, 800, 600));
window.as_window().show();
app.exec();
}
This library is licensed under the Apache 2.0 license.
If you want to learn more about rusty_gui, you can read the learning guide.
If you want to contribute to rusty_gui, you can fork the repository and submit a pull request. Such as:
If you have any questions or concerns, you can open an issue on the repository. You should add a prefix label to indicate your main requirements. Such as:
For more information, please visit the GitHub repository.