When I press a button I need to display a picture. The path to this picture is stored in variable.
This is the main.py:
import eel
eel.init('web')
@eel.expose
def set_image_src(image_path):
eel.updateImage(image_path)
eel.start('index.html', size=(600, 400))
image_path = #path to image
set_image_src(image_path)
This is the html file (I am lazy to put here the JS file so I put it into a html):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Eel App</title>
<script type="text/javascript" src="/eel.js"></script>
</head>
<body>
<h1>Image Display</h1>
<!-- Image tag with id "image-display" -->
<img id="image-display" src="" alt="Image">
<script>
function updateImage(image_path) {
document.getElementById('image-display').src = image_path;
}
eel.expose(updateImage);
</script>
</body>
</html>