473,657 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: Detect a sequence of keystrokes in an os independent way

Hi!

I was able to do this in the following way:

import os

fKey= raw_input('')
if fKey=='ab':
print(os.listdi r(os.getcwd()))
Is there a better way to do this?

Thanks,

Raj

On Wed, Aug 20, 2008 at 2:21 PM, Rajanikanth Jammalamadaka
<ra*********@gm ail.comwrote:
Hi!

Can somebody tell me if there is an os independent way to detect a
sequence of key strokes. For example, I want to start some other
program once the user presses a couple of keys: ex: key a and then key
b

Thanks,

Raj

--
"For him who has conquered the mind, the mind is the best of friends;
but for one who has failed to do so, his very mind will be the
greatest enemy."

Rajanikanth


--
"For him who has conquered the mind, the mind is the best of friends;
but for one who has failed to do so, his very mind will be the
greatest enemy."

Rajanikanth
Aug 20 '08 #1
0 812

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
4576
by: R. Rajesh Jeba Anbiah | last post by:
Here is a nice code to detect utf-8 <http://in2.php.net/utf8_encode#39986> But, I couldn't find out the logic behind the script. If anyone knows that please share. Particularly I would like to detect other encodings too. So, I would like to know the logic. For example these texts are in TSCII encoding (for Tamil): Žì¸õ. þÐ ¾Á¢Æ¢ø ¯ûÇ Åâ. þ¨¾ ¯í¸Ç¡ø ÀÊì¸ ÓÊó¾¡ø, ¯í¸û ¯Ä¡Å¢Â¢ø ±ó¾...
1
20443
by: Scott Shaw | last post by:
Hi all, I was wondering if you could help out with this problem that I am having. What I am trying to do is detect keyboard input in a while loop without halting/pausing the loop until the key is pressed (without hitting return). I looked at serveral faq's on the net and installed the cspan readkey module and neither seems to work most likey its me since I am getting frustrated. but anyway here's a sample code. while (1) { if...
6
3103
by: Krat | last post by:
Hi, I want to get all key press messages and for some keys I want to generate extra key press messages to simulate fast typing. For example if someone press 'H' my app should catch and change it with "Hello". It should work system wide. I know little about hooks and playback but it does not help me. I am waiting for your help. Thanks in advance.
13
1759
by: michael sorens | last post by:
I have a lengthy sequence of operations that are executed and reported on in a status window in a Windows Form application. Some work is done by background threads but other work is not. I am wondering how to recognize if the user presses an Escape (or even just a Shift key if that is simpler) so I may then abort the remaining foreground operations. To recognize a shift key I tried: if ((Control.ModifierKeys & Keys.Shift) ==...
2
5037
by: Justin | last post by:
I'm creating a kiosk type application and this would be too simple for someone to figure out: Private Declare Function GetAsyncKeyState Lib "user32" ( ByVal vKey As Short) As Short Const VK_ESCAPE As Short = &H1B How can I upgrade this to detect multiple keystrokes? For example CRTL + E Any points in the right direction would be much appreciated. VB.NET 2005
5
1807
by: =?ISO-8859-1?Q?Marcel_M=FCller?= | last post by:
Hi, I have a question about the execution sequence of the postfix increment operator with respect to a function call. void foo(int type, int*& data); int* sequence;
4
6464
by: raylopez99 | last post by:
Compound question: first, and this is not easy, if there's a way to detect multiple simultaneous key presses in C# let me know (in the below code, keys c and d being pressed simultaneously or nearly so). I researched this and for C# (as opposed to MFC) there is no library function, and no easy way, though some code on the net suggested that you set up a thread that 'lives' for a certain time, then, if keys are pressed in that certain...
0
764
by: Rajanikanth Jammalamadaka | last post by:
Hi! Can somebody tell me if there is an os independent way to detect a sequence of key strokes. For example, I want to start some other program once the user presses a couple of keys: ex: key a and then key b Thanks, Raj
0
609
by: Fredrik Lundh | last post by:
Rajanikanth Jammalamadaka wrote: http://effbot.org/pyfaq/how-do-i-get-a-single-keypress-at-a-time.htm (checking the cookbook might also be a good idea) </F>
0
8392
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8823
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7321
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1607
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.