Skip to content

Conversation

@catilac
Copy link
Contributor

@catilac catilac commented Dec 22, 2025

The background_image stuff works. And we are able to set a more appropriate asset path than the location of python
Created a new Config type based on a HashMap. It should do for now, but maybe there is a better solution.

TODO:

  • Set asset path based on where the sketch location is

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),
Copy link
Contributor Author

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

Comment on lines 20 to 32
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
Copy link
Contributor Author

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?

Copy link
Member

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

@catilac catilac changed the title WIP background_image example in python background_image example in python Dec 24, 2025
@catilac catilac marked this pull request as ready for review December 24, 2025 05:45
pub extern "C" fn processing_init() {
error::clear_error();
error::check(init);
error::check(|| init(None));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll eventually need to accept configuration over FFI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants