You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ These steps assume that you already have a basic tauri application available. Al
48
48
49
49
- run `npm run tauri add python`
50
50
- add `src-tauri/src-python/main.py` and modify it acording to your needs, for example add `def greet_python(intput): return str(input) + " from python"`
51
-
- modify `src-tauri/src/lib.rs` and change `.plugin(tauri_plugin_python::init())` to `.plugin(tauri_plugin_python::init(["greet_python"]))`; make sure you list all python functions you
51
+
- modify `src-tauri/src/lib.rs` and change `.plugin(tauri_plugin_python::init())` to `.plugin(tauri_plugin_python::init_and_register(["greet_python"]))`; make sure you list all python functions you
52
52
want to call
53
53
- add `"bundle": {"resources": [ "src-python/**/*"],` to `tauri.conf.json` so that python files are bundled with your application
54
54
- add the plugin in your js, so
@@ -71,7 +71,7 @@ def greet_python(rust_var)
71
71
print(rust_var)
72
72
returnstr(rust_var) +" from python"
73
73
```
74
-
- add `.plugin(tauri_plugin_python::init(vec!["greet_python"))` to `tauri::Builder::default()`, usually in `src-tauri/src/lib.rs`. This will initialize the plugin and make the python function "greet_python" available from javascript.
74
+
- add `.plugin(tauri_plugin_python::init_and_register(vec!["greet_python"))` to `tauri::Builder::default()`, usually in `src-tauri/src/lib.rs`. This will initialize the plugin and make the python function "greet_python" available from javascript.
75
75
- add javascript for python plugin in the index.html file directly or in your somewhere in your javascript application. For vanilla javascript / iife, the modules can be found in `window.__TAURI__.python`. For modern javascript:
# "allow-register-function" is disabled due to the "secure by default" concept. It can be enabled if the UI isn't exposed via network and secured against XSS sufficiently.
5
8
# "allow-run-python" is also disabled as it allows to run random python code. It must not be enabled if the UI is exposed via network.
0 commit comments