473,405 Members | 2,262 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,405 software developers and data experts.

capturing ESC, page up/down in Python

Is there any way to capture the keyboard events ESC, page up (next
page), page down (previous page) in Python?. I mean, how can I capture
if user presses one of those keys in a terminal based application? I
was thinking about pygame.key.get_pressed from the pygame module, but
I don't feel really happy about importing pygame in a non related game
project.
Oct 26 '08 #1
2 1898
jordilin <jo******@gmail.comwrote:
>
Is there any way to capture the keyboard events ESC, page up (next
page), page down (previous page) in Python?. I mean, how can I capture
if user presses one of those keys in a terminal based application? I
was thinking about pygame.key.get_pressed from the pygame module, but
I don't feel really happy about importing pygame in a non related game
project.
Are you talking about Windows or Unix? It matters.

In Windows, if you don't need a bunch of other features, you should check
out the WConio package. It has kbhit and getch functions that can do this.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Oct 27 '08 #2
jordilin <jo******@gmail.comwrote:
>Is there any way to capture the keyboard events ESC, page up (next
page), page down (previous page) in Python?. I mean, how can I capture
if user presses one of those keys in a terminal based application? I
was thinking about pygame.key.get_pressed from the pygame module, but
I don't feel really happy about importing pygame in a non related game
project.
Much of Pygame is a wrapper for the SDL library. Would you be happier
using that part if it had been called PySDL?

Oct 27 '08 #3

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

Similar topics

5
by: Moosebumps | last post by:
I have a large set of Python scripts that interface with command line utilities (primarily Perforce). I am currently capturing ALL the text output in order to get results and such. I am using the...
5
by: Earl Eiland | last post by:
Anyone know how to capture text from GUI output? I need to process information returned via a GUI window. Earl
8
by: Zvonko | last post by:
Hi! Is it possible to capture an event when user leaves the page and execute some code? Not when he closes the window. Any ideas?
33
by: Joerg Schuster | last post by:
Hello, Python regular expressions must not have more than 100 capturing groups. The source code responsible for this reads as follows: # XXX: <fl> get rid of this limitation! if...
4
by: Steve Wolfie | last post by:
Hello all: Again, let me thank everyone who has helped in the past. Can't wait till I can help out with some advice of my own. Now, I am building an app that wishes to retrieve the output of...
2
by: Andrew | last post by:
Hi, I have a problem capturing the checkboxes that are checked, I get false irrespective of wether they are checked or not. I have gone thru the sample code on this forum, but they dun seem to...
10
by: Andrew | last post by:
Hi, I have a messagebox that pops up due to an event. I did it in javascript. ie. alert("Time's up. Assessment Ended"); I want to capture the OK and Cancel events of this alert messagebox. My...
2
by: Phil Galey | last post by:
I'm using the ProcessCmdKey event to capture various keys that are pressed. However, I'm having trouble capturing the combination of the CTRL key and, say, the DOWN key. If I just press the CTRL...
6
by: Ed Leafe | last post by:
I've been approached by a local business that has been advised that they need to start capturing and archiving their instant messaging in order to comply with Sarbanes-Oxley. The company is largely...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.