This is my first time trying something out with eel. I've got a python script with some functions and I'm trying to communicate with them using @eel.expose
but it gives me a javascript error - main.html:10 Uncaught TypeError: eel.startEncryption is not a function
Here's my code:
<head>
<title>Undefined</title>
<link rel="stylesheet" href="w3pro.css">
<script type="text/javascript" src="/eel.js"></script>
<script>
function startEncryption(mode){
massage = document.getElementById("massage").value;
code = document.getElementById("code").value;
string = eel.startEncryption(mode, massage, code);
document.getElementById("result").innerHTML += string;
}
</script>
</head>
<body>
<header class="w3-panel">
<h1>Vigenere Encryption</h1>
</header>
<div class="w3-panel">
<span>Message:<input type="text" id="massage"></span>
<br>
<span>Code:<input type="text" id="code"></span>
<br>
<span>Encrypted/Decrypted:<input type="text" id="result" readonly></span>
<br>
<input type="button" value="Encrypt" onclick="startEncryption(1)">
<input type="button" value="Decrypt" onclick="startEncryption(2)">
</div>
</body>
import eel
eel.init('C:\\Users\\Fantomas\\Documents\\Programming\\cipher\\web')
eel.start('main.html')
@eel.expose
def startEncryption(mode : int, message : string, code : string):
if mode == 1:
ciphertext = encryptMessage(code, message)
elif mode == 2:
ciphertext = decryptMessage(code, message)
return ciphertext;
I've got the eel.js file in my directory
Modufy the of your to:
import eel
eel.init('C:\\Users\\Fantomas\\Documents\\Programming\\cipher\\web')
@eel.expose
def startEncryption(mode : int, message : string, code : string):
if mode == 1:
ciphertext = encryptMessage(code, message)
elif mode == 2:
ciphertext = decryptMessage(code, message)
return ciphertext;
eel.start('main.html')
put eel.start('main.html')
after exposing all shared functions.
Looking for your comments.
Good Luck