Skip to content

Instantly share code, notes, and snippets.

@m3g4p0p

m3g4p0p/app.py

Created Aug 8, 2020
Embed
What would you like to do?
eel window communication
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))
<!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>
<!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