Is it possible to take input without clicking on ENTER key in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Is it possible to take input without clicking on ENTER key in python?

25th Aug 2020, 12:41 AM
Ankan Mahapatra
Ankan Mahapatra - avatar
8 Answers
+ 6
Yes, you will have to set a timeout in order to do so.
25th Aug 2020, 2:04 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 5
Jan Markus you don't actually need OOP for this, it can be done using simple functions.
25th Aug 2020, 4:23 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 5
Kode Krasher I am not sure, some things don't work well on SL. I tried the script on my computer an it worked fine though, I'll share the script.
25th Aug 2020, 6:56 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 5
This is the one: https://stackoverflow.com/questions/1335507/keyboard-input-with-timeout It's python2, just add parenthesis to print()
25th Aug 2020, 7:11 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 5
Kode Krasher that's why I never post codes on SoloLearn ;)
25th Aug 2020, 7:16 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 3
“input without entering” Does that mean that you just declare a variable with a string?
25th Aug 2020, 12:53 AM
Rowsej
Rowsej - avatar
+ 2
Jan Markus, can you please send me the code?
25th Aug 2020, 4:28 AM
Ankan Mahapatra
Ankan Mahapatra - avatar
+ 1
I know I'm late, but here https://pypi.org/project/getkey/
9th Dec 2021, 3:01 AM
Nicholas Cheng