INNER CODE UNIT · Rust
pyalert
autopilot-rs/autopy · src/alert.rs:22
fn pyalert(
msg: &str,
title: Option<&str>,
default_button: Option<&str>,
cancel_button: Option<&str>,
) -> PyResult<bool> {
let title = title.unwrap_or("AutoPy Alert");
let resp = autopilot::alert::alert(msg, Some(title), default_button, cancel_button);
Ok(match resp {
Response::Default => true,
Response::Cancel => false,
})
}
/// This module contains functions for displaying alerts.
#[pymodule]
pub fn alert(py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add("alert", wrap_pyfunction!(pyalert)(py)?)?;