Hi everyone,
I am working on a project (just started) in PYTHON and I want to create a keylogger for 2 languages english and greek. For this I have created the below (it is under "constructi on") code.
"""
from pynput.keyboard import Key, Listener
from langdetect import detect
from pynput import keyboard
def on_press(key):
global string
if key == keyboard.Key.es c: #if button escape is pressed close the program
listener.stop()
elif key == keyboard.Key.sp ace:
print(string)
string=""
else:
string = ''.join([string,str(key) .replace("'","" )])
string=""
controller = keyboard.Contro ller()
# Collect events until released
listener = keyboard.Listen er(on_press=on_ press)
listener.start( )
"""
I run it and all good until I change the language.
The problem that I am facing is explained below.
If I start typing in english, the printed result is in english but when I change in greek the printed result remains english.
If I start typing in greek the printed result is in greek, but when I change in english the result remains greek.
How can I solve this problem in order to take the same language result after an input language change?
Any help or advice would be great!
Thanks in advance.
I am working on a project (just started) in PYTHON and I want to create a keylogger for 2 languages english and greek. For this I have created the below (it is under "constructi on") code.
"""
from pynput.keyboard import Key, Listener
from langdetect import detect
from pynput import keyboard
def on_press(key):
global string
if key == keyboard.Key.es c: #if button escape is pressed close the program
listener.stop()
elif key == keyboard.Key.sp ace:
print(string)
string=""
else:
string = ''.join([string,str(key) .replace("'","" )])
string=""
controller = keyboard.Contro ller()
# Collect events until released
listener = keyboard.Listen er(on_press=on_ press)
listener.start( )
"""
I run it and all good until I change the language.
The problem that I am facing is explained below.
If I start typing in english, the printed result is in english but when I change in greek the printed result remains english.
If I start typing in greek the printed result is in greek, but when I change in english the result remains greek.
How can I solve this problem in order to take the same language result after an input language change?
Any help or advice would be great!
Thanks in advance.