u6
This commit is contained in:
parent
65411da66c
commit
b865ea307e
2 changed files with 41 additions and 1 deletions
28
src/u6.py
Normal file
28
src/u6.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import turtle
|
||||||
|
|
||||||
|
t = turtle.Turtle()
|
||||||
|
t.speed(100)
|
||||||
|
t.penup()
|
||||||
|
|
||||||
|
def a():
|
||||||
|
t.dot(100, "red")
|
||||||
|
t.dot(85, "white")
|
||||||
|
t.setheading(-135)
|
||||||
|
t.forward(50)
|
||||||
|
t.write("80", font=("Arial", 48))
|
||||||
|
|
||||||
|
def b():
|
||||||
|
t.dot(100, "red")
|
||||||
|
t.dot(85, "white")
|
||||||
|
t.setheading(-135)
|
||||||
|
t.forward(50)
|
||||||
|
t.write("6 t", font=("Arial", 48))
|
||||||
|
|
||||||
|
def main():
|
||||||
|
func = input("a or b\n")
|
||||||
|
globals().get(func)()
|
||||||
|
|
||||||
|
input()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
14
src/u6.rs
14
src/u6.rs
|
@ -1 +1,13 @@
|
||||||
pub fn main() {}
|
use std::ffi::CString;
|
||||||
|
use pyo3::ffi::c_str;
|
||||||
|
use pyo3::prelude::*;
|
||||||
|
|
||||||
|
static code: &'static str = include_str!("u6.py");
|
||||||
|
|
||||||
|
pub fn main() {
|
||||||
|
Python::with_gil(|py| {
|
||||||
|
let c = CString::new(code.as_bytes()).unwrap();
|
||||||
|
let activator = PyModule::from_code(py, c.as_c_str(), c_str!("main.py"), c_str!("main")).unwrap();
|
||||||
|
activator.call_method("main", (), None).unwrap();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue