Created
August 6, 2023 08:08
-
-
Save nazmulpcc/b52529610956940aace1a35263184281 to your computer and use it in GitHub Desktop.
Calling webview from python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from ctypes import CDLL, c_int, c_char_p, c_void_p | |
| # Load the shared library | |
| # https://github.com/webview/webview/ | |
| libwebview = CDLL('/path/to/libwebview.so') | |
| # Define the functions with their argument types and return types | |
| libwebview.webview_create.argtypes = [c_int, c_void_p] | |
| libwebview.webview_create.restype = c_void_p | |
| libwebview.webview_navigate.argtypes = [c_void_p, c_char_p] | |
| libwebview.webview_navigate.restype = None | |
| libwebview.webview_run.argtypes = [c_void_p] | |
| libwebview.webview_run.restype = None | |
| # Usage example: | |
| debug = 1 | |
| window = None # You can replace this with a proper window pointer if needed | |
| handle = libwebview.webview_create(debug, window) | |
| url = b"http://reactphp.org" | |
| libwebview.webview_navigate(handle, url) | |
| libwebview.webview_run(handle) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment