Im making a pyweview desktop stand alone app and I have 2 things I cant seem to find much on. Mainly how to get it to see local src files and how to implement the windows snap feature. By that I mean the windows key + direction to snap to that side of the screen. I found a potential JS option for resizeing but have yet to test it.
How to make frameless window draggable in pywebview?
This post gave me the answer to making it dragable.
All the examples I can find of it using things like images have to be done with a weblink and that works but the point of this particular project is to have it self contained so is there a way to have the html load local files?
The html is loaded through window.load_html() and in the html I have tried every file path I can think of but so far nothing works. Even using the full system path. Bellow is a simple example just replace dots.svg with any local image you have. if the html is loaded on its own it works just fine. If loaded though pyweview there is no image. I am still new to JS but is there maybe a way to use JS to load the image?
import webview
html = """
<!DOCTYPE html>
<html lang="en">
<h1>This is dynamically loaded HTML</h1>
<body>
<img src="images/dots.svg"> image should be here
</body>
</html>
"""
def load_html(window):
window.load_html(html)
if __name__ == '__main__':
window = webview.create_window('Load HTML Example', html=html)
webview.start(load_html, window)