Python

Moderators: None (Apply to moderate this forum)
Number of threads: 474
Number of posts: 1166

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
I need help with Python equivalent to FORTH "EKEY" Posted by rgillies on 31 Dec 2002 at 11:58 PM
I'm having no luck with finding the equivalent Python function that waits for the user to hit a key to execute a procedure. This would be the functional equivalent of the FORTH languge word KEY, or EKEY.

What KEY, or EKEY does is return onto the stack the ASCII value of the key that was pressed. I could then determine if PAGE UP key was hit, for example, so that my function can scroll the screen.

Unfortunately, raw_input() waits for you to hit ENTER.

Can someone help me?
Report
Re: I need help with Python equivalent to FORTH "EKEY" Posted by infidel on 2 Jan 2003 at 7:46 AM
: I'm having no luck with finding the equivalent Python function that waits for the user to hit a key to execute a procedure. This would be the functional equivalent of the FORTH languge word KEY, or EKEY.
:
: What KEY, or EKEY does is return onto the stack the ASCII value of the key that was pressed. I could then determine if PAGE UP key was hit, for example, so that my function can scroll the screen.
:
: Unfortunately, raw_input() waits for you to hit ENTER.
:
: Can someone help me?

If you are on a Windows machine, try the msvcrt module's getch() method.

infidel

Report
Re: I need help with Python equivalent to FORTH "EKEY" Posted by rgillies on 2 Jan 2003 at 8:17 PM
: : I'm having no luck with finding the equivalent Python function that waits for the user to hit a key to execute a procedure. This would be the functional equivalent of the FORTH languge word KEY, or EKEY.
: :
: : What KEY, or EKEY does is return onto the stack the ASCII value of the key that was pressed. I could then determine if PAGE UP key was hit, for example, so that my function can scroll the screen.
: :
: : Unfortunately, raw_input() waits for you to hit ENTER.
: :
: : Can someone help me?
:
: If you are on a Windows machine, try the msvcrt module's getch() method.
:
:
:
Thanks for your suggestion. That's just where I located kbdhit() and getch() and a snippet of code on the Activestate.com website.

Would you or anyone else know what module contains kbdhit() and
getchr() on the DOS version of the msvcrt module?

Thanks in advance.
Report
Re: I need help with Python equivalent to FORTH "EKEY" Posted by infidel on 3 Jan 2003 at 7:53 AM
: : If you are on a Windows machine, try the msvcrt module's getch() method.
: :
: Thanks for your suggestion. That's just where I located kbdhit() and getch() and a snippet of code on the Activestate.com website.
:
: Would you or anyone else know what module contains kbdhit() and
: getchr() on the DOS version of the msvcrt module?

Are you saying the DOS version doesn't have the msvcrt module or that the msvcrt module in the DOS version doesn't have these functions? I've never before done any ncurses programming, but maybe the curses module has everything you need.


infidel

Report
Re: I need help with Python equivalent to FORTH "EKEY" Posted by rgillies on 4 Jan 2003 at 1:37 PM
: : : If you are on a Windows machine, try the msvcrt module's getch() method.
: : :
: : Thanks for your suggestion. That's just where I located kbdhit() and getch() and a snippet of code on the Activestate.com website.
: :
: : Would you or anyone else know what module contains kbdhit() and
: : getchr() on the DOS version of the msvcrt module?
:
: Are you saying the DOS version doesn't have the msvcrt module or that the msvcrt module in the DOS version doesn't have these functions? I've never before done any ncurses programming, but maybe the curses module has everything you need.
:
:
I booted the DOS version of PYHT_DOS.EXE (version 1.5.2), built on June 15, 1999. Double checked -- and msvcrt module's nowhere to be found. I couldn't find the curses module either. Perhaps I should dig around on the Web to find a survival guide for the DOS version.

Any suggestions for hints and tips for getting documentation would be greatly appreciated.

BTW, I got my Python version of FORTH's KEY implemented on the Windows version, finally.
Report
Re: I need help with Python equivalent to FORTH "EKEY" Posted by infidel on 6 Jan 2003 at 9:24 AM
: I booted the DOS version of PYHT_DOS.EXE (version 1.5.2), built on June 15, 1999. Double checked -- and msvcrt module's nowhere to be found. I couldn't find the curses module either. Perhaps I should dig around on the Web to find a survival guide for the DOS version.
:
: Any suggestions for hints and tips for getting documentation would be greatly appreciated.
:
: BTW, I got my Python version of FORTH's KEY implemented on the Windows version, finally.

Not sure what to tell you. I avoid DOS like the plague. Best I can recommend is to perhaps find a newer version of python. I'll see if I can find anything.


infidel

Report
Re: I need help with Python equivalent to FORTH "EKEY" Posted by rgillies on 6 Jan 2003 at 11:37 PM
This message was edited by rgillies at 2003-1-6 23:39:26

: Not sure what to tell you. I avoid DOS like the plague. Best I can recommend is to perhaps find a newer version of python. I'll see if I can find anything.
:
:
Many thanks. Some version of DOS would be of interest to me because we have this unused old 486 laptop running DOS and WIN 3.0 that I plan on using to data log and control our oven/cooler used to subject a batch of PCB's to temperature tests. This would include a serial terminal running scripts to control the setpoints on this oven. I've already whipped up some graphing code (in FORTH) and am converting everything over to Python. The challenge poses an opportunity for me to get familiar with Python. And any code of use to the Python community would be placed in the public domain. This could be fun.


Report
Re: I need help with Python equivalent to FORTH "EKEY" Posted by infidel on 7 Jan 2003 at 2:17 PM
: Many thanks. Some version of DOS would be of interest to me because we have this unused old 486 laptop running DOS and WIN 3.0 that I plan on using to data log and control our oven/cooler used to subject a batch of PCB's to temperature tests. This would include a serial terminal running scripts to control the setpoints on this oven. I've already whipped up some graphing code (in FORTH) and am converting everything over to Python. The challenge poses an opportunity for me to get familiar with Python. And any code of use to the Python community would be placed in the public domain. This could be fun.

Take a look at http://www.python.org/download/download_windows.html

Down at the bottom are a couple of links for Python for DOS that should give you a newer version.


infidel

Report
Re: I need help with Python equivalent to FORTH "EKEY" Posted by rgillies on 8 Jan 2003 at 7:34 PM
: Take a look at http://www.python.org/download/download_windows.html
:
: Down at the bottom are a couple of links for Python for DOS that should give you a newer version.
:
:
Thanks again. I think I know why I couldn't find the MSVCRT module. It's not a *.PY module, but a DLL of Microsoft C runtime module.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.