Created
August 8, 2020 13:25
-
-
Save m3g4p0p/674b9ca6a763a60b030c95581b08edad to your computer and use it in GitHub Desktop.
eel window communication
This file contains 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
import eel | |
eel.init('.') | |
@eel.expose | |
def send_message(message): | |
eel.on_message(message) | |
eel.show('test.html') | |
eel.start('main.html', size=(300, 100)) |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Main</title> | |
<script src="/eel.js"></script> | |
</head> | |
<body> | |
<input type="text" id="message"> | |
<script> | |
const message = document.getElementById('message') | |
message.addEventListener('input', () => { | |
eel.send_message(message.value) | |
}) | |
</script> | |
</body> | |
</html> |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Test</title> | |
<script src="/eel.js"></script> | |
</head> | |
<body> | |
<div id="test"></div> | |
<script> | |
const test = document.getElementById('test') | |
eel.expose(on_message) | |
function on_message(message) { | |
test.textContent = message | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment