Python Forum
Python - Most effective way to correct keyboard-user-input.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python - Most effective way to correct keyboard-user-input.
#1
Hello everyone,
I am working on a project, which corrects user input (reads input stream from keyboard with keyboard module) based on some rules.
I am trying to find the fastest way to delete and write the corrected word, after a user enters a wrong one.
Currently I am using pynput, but I noticed that it faces problem when the user types very fast.
To give you a better idea of what I am looking for, I quote the above pseudocode.

user enters a word
some_checks_are_made
if (ok):
do nothing
else:
press_the_backspace_button_until_delete_of_wrong_entered_word
write_the_new_word

To make it even more clear, the main problem I am facing is that my program delays on deleting and writing the correct word and the user overlays the words written from the program.
e.g. (just an example - not program's functionality)

user writes 'honeu' (the correct word is honey)
program starts deleting and deletes until 'ho___'
user starts typing next word 'hello'
the result is 'hohelloney'
I tried explaining it as better as I could.

I am just asking for any suggestion or solution to this problem.
! Some suggestion was, to grab the word as it's being typed, calculate your correction, then go back to the text and make the correction all at once if the word is still there. This means storing the text in a buffer (not repeatedly simulating backspace presses).
But I don't know how to go back to the exact position that the word was written.
Thanks in advance.
Reply
#2
Please use proper tags and keywords.
Reply
#3
(Apr-06-2020, 10:38 AM)pyzyx3qwerty Wrote: Please use proper tags and keywords.
I really can't find the edit, in order to fix this. :(
Reply
#4
(Apr-06-2020, 12:25 PM)ppel123 Wrote:
(Apr-06-2020, 10:38 AM)pyzyx3qwerty Wrote: Please use proper tags and keywords.
I really can't find the edit, in order to fix this. :(

present on the lower right hand side
Reply
#5
(Apr-06-2020, 08:08 AM)ppel123 Wrote: Hello everyone,
I am working on a project, which corrects user input (reads input stream from keyboard with keyboard module) based on some rules.
I am trying to find the fastest way to delete and write the corrected word, after a user enters a wrong one.
Currently I am using pynput, but I noticed that it faces problem when the user types very fast.
To give you a better idea of what I am looking for, I quote the above pseudocode.

[inline]user enters a word
some_checks_are_made
if (ok):
do nothing
else:
press_the_backspace_button_until_delete_of_wrong_entered_word
write_the_new_word[/inline]

To make it even more clear, the main problem I am facing is that my program delays on deleting and writing the correct word and the user overlays the words written from the program.
e.g. (just an example - not program's functionality)

[inline]user writes 'honeu' (the correct word is honey)
program starts deleting and deletes until 'ho___'
user starts typing next word 'hello'
the result is 'hohelloney'
I tried explaining it as better as I could.[/inline]

I am just asking for any suggestion or solution to this problem.
! Some suggestion was, to grab the word as it's being typed, calculate your correction, then go back to the text and make the correction all at once if the word is still there. This means storing the text in a buffer (not repeatedly simulating backspace presses).
But I don't know how to go back to the exact position that the word was written or which is the best way to write the corrected.
Thanks in advance.
Reply
#6
NO, there is a button with a pencil on the right hand side to edit
Reply
#7
(Apr-06-2020, 02:18 PM)pyzyx3qwerty Wrote: NO, there is a button with a pencil on the right hand side to edit
I think this is why I am not seeing an edit button. Sorry for the mess I made in the comment section ->
https://python-forum.io/misc.php?action=help&hid=31
Reply
#8
You are a user, right? Shouldn't you be getting the edit button
Reply
#9
(Apr-07-2020, 11:22 AM)pyzyx3qwerty Wrote: You are a user, right? Shouldn't you be getting the edit button
now I see it. !)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Loop back through loop based on user input, keeping previous changes loop made? hbkpancakes 2 136 Nov-21-2020, 02:35 AM
Last Post: hbkpancakes
  user input for multi-dimentional list without a prior iteration using input() Parshaw 6 351 Sep-22-2020, 04:46 PM
Last Post: Parshaw
  How to time a user's input Tbot1000 2 278 Aug-31-2020, 09:39 PM
Last Post: Larz60+
  converting user input to float troubles RecklessTechGuy 3 396 Aug-17-2020, 12:41 PM
Last Post: deanhystad
  Validating user input WJSwan 2 359 Jul-06-2020, 07:21 AM
Last Post: menator01
  Hi, I need help with defining user's input and applying it to code. jlmorenoc 2 453 Jun-24-2020, 02:10 PM
Last Post: pyzyx3qwerty
  if the input is not number, let user input again teatea 14 966 Jun-02-2020, 07:03 PM
Last Post: ibutun
  How to allow user input only if certain requirements are met vininhosts 3 457 May-28-2020, 06:15 PM
Last Post: micseydel
  Python - Keyboard module - Threading problem ppel123 1 537 Apr-13-2020, 04:49 PM
Last Post: deanhystad
  Keyboard Module Python - Suppress input while writing to window ppel123 0 397 Apr-08-2020, 02:51 PM
Last Post: ppel123

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020