-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspin_py.cpp
More file actions
31 lines (27 loc) · 1.31 KB
/
spin_py.cpp
File metadata and controls
31 lines (27 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "include/spinners.hpp" // Incluye la librería de C++
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
namespace py = pybind11;
PYBIND11_MODULE(spinners, m)
{
m.doc() = "Spinners module to create terminal spinners with color support";
// Exporta la función `getSpinner`
/*m.def("get_spinner", &spinners::getSpinner, "Get spinner symbols by name",*/
/*py::arg("key"));*/
// Define la clase Spinner
py::class_<Spinner>(m, "Spinner")
.def(py::init<>(), "Default constructor") // Constructor sin parámetros
.def("set_color", &Spinner::setColor, "Set the spinner color",
py::arg("color_name"))
.def("set_interval", &Spinner::setInterval,
"Set the spinner interval in milliseconds", py::arg("interval"))
.def("set_text", &Spinner::setText,
"Set the text displayed with the spinner", py::arg("text"))
.def("set_symbols", &Spinner::setSymbols,
"Set the spinner symbols", py::arg("symbols"))
// En la definición de la clase Spinner, añade:
/*.def("get_spinner", &spinners::Spinner::getSpinner, "Get spinner symbols by name",*/
/* py::arg("key"))*/
.def("start", &Spinner::start, "Start the spinner animation")
.def("stop", &Spinner::stop, "Stop the spinner animation");
}