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

Recognizing the <enter> key

Hey guys,
I am new to Python and I was wondering how to get a program to recognize the <enter> key when a user hits it
thnx
Oct 6 '07 #1
2 20741
Hey guys,
I am new to Python and I was wondering how to get a program to recognize the <enter> key when a user hits it
thnx
use pygame and you have code for using keys ...or use this code with "Tkinter" module :
Expand|Select|Wrap|Line Numbers
  1. from Tkinter import *
  2.  
  3. root = Tk()
  4. def greet(*ignore): print 'Hello World'
  5. root.bind('<Return>', greet)
  6. root.mainloop()
Oct 6 '07 #2
bartonc
6,596 Expert 4TB
Hey guys,
I am new to Python and I was wondering how to get a program to recognize the <enter> key when a user hits it
thnx
Expand|Select|Wrap|Line Numbers
  1. raw_input('Press any key to continue')
  2. # run here after a key is pressed
  3.  
  4. # or #
  5.  
  6. key = "anything"
  7. while key != "":
  8.     key = raw_input('Hit <Enter> to continue')
Oct 7 '07 #3

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

Similar topics

11
by: Denis Hierstein | last post by:
I need a function, witch make a break in a for-loop and wait for the <enter>-key ... when I use Pascal I just use the Read; or the ReadLn;-function, then the loop stop as long as the user push the...
7
by: jerrygarciuh | last post by:
Hello, I have been playing with various Googled solutions for capturing the <Enter> key to suppress form submission. My first question is whether anyone has a script that works in all common...
7
by: Susan Bricker | last post by:
I know that I saw some information concerning the <shift>+<enter> combination use to bypass launching an Access mdb application and enter the Access design workspace. Would someone please direct...
6
by: tor | last post by:
Hello How can I use an other key then TAB to move from one textBox to another?? Torfinn
0
by: VMI | last post by:
If I'm in a multi-line textbox and I'm writing a postal address (ie. write ist line and press <Enter>, write 2nd line and press <Enter>, etc...) how can I make sure that the Enter key will always...
2
by: JP | last post by:
Hi, It's a login screen, so users enter their ID/Password and hit <ENTER> instead of clicking on Login button. But when they hit <ENTER> an Image Button gets clicked. I want to make my Login...
5
by: DotNetGruven | last post by:
Hi, I have a web form which has: - Login area with - email textbox - password textbox - <enter> button to log in - search area with - string to search for textbox
2
by: Rocio | last post by:
I have a aspx page, with 2 controls (ascx). Control1 contains a SEARCH button, and textbox to enter the string to search for. Control 2 contains a LOGIN button, and 2 text boxes to enter the...
0
by: Tom Edelbrok | last post by:
I'm using VS 2005 to develop an intranet asp.net web application and I get a weird situation. If I start out with any ASPX page that contains an ImageButton control followed by a TextBox control,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.