-
Notifications
You must be signed in to change notification settings - Fork 2
WIP background_image example in python #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
crates/processing_render/src/lib.rs
Outdated
| app.register_asset_source( | ||
| "assets_directory", | ||
| // TODO: set this path to the directory containing the main sketch file | ||
| AssetSourceBuilder::platform_default("TODO/TODO/TODO/libprocessing/assets", None), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This string is only here because I didn't want to put my directory into the commit lol
crates/processing_pyo3/src/lib.rs
Outdated
| let sys = PyModule::import(py, "sys")?; | ||
| let argv: Vec<String> = sys.getattr("argv")?.extract()?; | ||
| let os = PyModule::import(py, "os")?; | ||
| let path = os.getattr("path")?; | ||
| let dirname = path | ||
| .getattr("dirname")? | ||
| .call1(pyo3::types::PyTuple::new(py, &[&argv[0]])?)?; | ||
| let abspath = path | ||
| .getattr("abspath")? | ||
| .call1(pyo3::types::PyTuple::new(py, &[dirname])?)?; | ||
|
|
||
| println!("DEBUG MOMENT OF SUCCESS: {}", abspath); | ||
| // TODO: Pass this into Graphics for App init |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- clean this up. does a PyTuple need to be initialized this way? or there is a more elegant way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't remember 100% but I think there's a way to go from a rust tuple via into_py or something like that
The background_image stuff works. And we are able to set a more appropriate asset path than the location of
pythonTODO: