473,408 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Solve Pynput Problem when changing language?

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 "construction") 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.esc: #if button escape is pressed close the program
listener.stop()
elif key == keyboard.Key.space:
print(string)
string=""
else:
string = ''.join([string,str(key).replace("'","")])
string=""
controller = keyboard.Controller()
# Collect events until released
listener = keyboard.Listener(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.
Feb 19 '20 #1
0 1881

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: jeff | last post by:
Hello, I have a form that submits it's values to a pop-up window. I've simplied the code: <form name="formname" action="action.php" target="windowName" method="post" onsubmit="window.open('',...
0
by: HoloDoc | last post by:
Using VB.NET 2003 with .NET 1.1. I am using RSACryptoServiceProvider to encrypt various information. This generally is fine. As part of development for Arabic, i changed option: Control Panel...
1
by: mike | last post by:
Hi, I'd like advice from a .NETer. I have a loadcombo routine which sets the selectedindex to -1 if it's an "add record", but then it goes to a security routine which, based on permissions...
1
by: malcolm | last post by:
I have a scrollable vb.net form with a web browser (axWebBrowser) instance on it. All is well until I try to change the left/top (and perhaps height/width) of the web browser on the form. If...
1
by: Bruintje Beer | last post by:
Hi, I am new to javascript. How can I change the language in javascript when I click on a hyperlink. The idea is that people can change langugae on my index page but I have no idea how to to do...
1
by: rbinington | last post by:
Hi, I am trying to write a DNN module that has the ability to insert articles into an article repository. I want the users to be able to move pages around and enter text into the FCKEditor. I...
6
by: Martin Slater | last post by:
Hi all, I'm using a webbrowser control within an application for the UI and want to hide the flicker and redraw when changing pages. Ideally I want to render the new page to a seperate...
1
by: Tahir | last post by:
hi all, I am using Visual Studio 2005 as ASP.NET and C# developer. I have a problem with language. My operating system is Vista Home Professional Turkish and i am getting the compilation error...
0
by: =?Utf-8?B?RWQgT3R0bw==?= | last post by:
When changing a user's password in Active Directory Users... I get a strange error message (and the password change fails): Windows can not complete the password change for the user <insert user...
0
by: sunnyfunny | last post by:
Hello! If anyone can tell me how to change language of text in automatic edit button in GridView, to language which user has selected? By default its in english but i need to allow user to switch...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.