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

Getting the arrow keys to work properly in Python

Motoma
3,237 Expert 2GB
When I use the python interpreter on my remote machine, the arrow keys do not function properly. Instead of repositioning the cursor and recalling previous commands, I get ^[[A ^[[B ^[[C ^[[D written to the screen.
Is there a way I can bind these to the appropriate actions, or is this happening because of a misconfiguration elsewhere?
Jul 10 '07 #1
7 3502
bartonc
6,596 Expert 4TB
When I use the python interpreter on my remote machine, the arrow keys do not function properly. Instead of repositioning the cursor and recalling previous commands, I get ^[[A ^[[B ^[[C ^[[D written to the screen.
Is there a way I can bind these to the appropriate actions, or is this happening because of a misconfiguration elsewhere?
Hey, Motoma. Will you remind me of you OS environment, please.
Jul 10 '07 #2
Motoma
3,237 Expert 2GB
Hey, Motoma. Will you remind me of you OS environment, please.
Oops, sorry guys, I am running this on Linux :P
Jul 10 '07 #3
bartonc
6,596 Expert 4TB
When I use the python interpreter on my remote machine, the arrow keys do not function properly. Instead of repositioning the cursor and recalling previous commands, I get ^[[A ^[[B ^[[C ^[[D written to the screen.
Is there a way I can bind these to the appropriate actions, or is this happening because of a misconfiguration elsewhere?
There are many different shells available; each with their own key bindings. Python's own shell does include a history feature, but doesn't do cursor movement (on Windows, anyway). I'd suggest a python based IDE or some other custom shell (I'll bet even EMACS has python features these days).

Hope that helps.
Jul 10 '07 #4
Motoma
3,237 Expert 2GB
There are many different shells available; each with their own key bindings. Python's own shell does include a history feature, but doesn't do cursor movement (on Windows, anyway). I'd suggest a python based IDE or some other custom shell (I'll bet even EMACS has python features these days).

Hope that helps.
Interesting, I am running Python 2.4 on Windows, and it does history and cursor movement just fine.

The research I did on my own provided very few results, the only fruitful one asserted that I need to recompile Python. My target machine is a tiny gumstix board with 32MB of on board storage, and only serial and ssh access, therefore the recompiling process is a long one and IDEs (and even emacs) are entirely out of the question.
Jul 10 '07 #5
bartonc
6,596 Expert 4TB
Interesting, I am running Python 2.4 on Windows, and it does history and cursor movement just fine.

The research I did on my own provided very few results, the only fruitful one asserted that I need to recompile Python. My target machine is a tiny gumstix board with 32MB of on board storage, and only serial and ssh access, therefore the recompiling process is a long one and IDEs (and even emacs) are entirely out of the question.
Ok - I take it back: The cursor will move right and left. I'm used to a full GUI IDE that lets me go up to a previous line and hit return to re-run that line, page up, page down, beginning and end, as I please.

I got by with IDLE for a long time, but I'm not sure of the memory requirements.
Jul 10 '07 #6
Motoma
3,237 Expert 2GB
Ok - I take it back: The cursor will move right and left. I'm used to a full GUI IDE that lets me go up to a previous line and hit return to re-run that line, page up, page down, beginning and end, as I please.

I got by with IDLE for a long time, but I'm not sure of the memory requirements.
Well, the problem with IDLE is that I don't actually have a screen connected to the device. Can IDLE work in a text only mode?
Jul 10 '07 #7
bartonc
6,596 Expert 4TB
Well, the problem with IDLE is that I don't actually have a screen connected to the device. Can IDLE work in a text only mode?
The only remoting hits that I am getting are for pydev under eclipse.
Jul 10 '07 #8

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

Similar topics

0
by: Paul Nathan | last post by:
While trying to write a simple game which uses the arrow keys, I noticed that under the subroutine that handles mybase.keydown, everytime I pressed any arrow keys, or in fact any of the 9 keys...
4
by: Andrew DeFaria | last post by:
I'm trying to use the onKeyDown event on a text field. I intersept the keystroke, interpret it and then do certain actions based on certain keys stuck. If a special key is stuck I replace the value...
3
by: Lachlan Hunt | last post by:
Hi, I've been looking up lots of documentation and trying to work out a cross-platform method of capturing a keyboard event and working out which key was pressed. From what I can find, there...
1
by: bj | last post by:
How to process arrow keys? Hello I need to catch arrow keys down event from control derivied from usercontrol -OnKeyDown method seems to work for all keys besides arrow keys -however OnKeyUp...
4
by: Neil Wallace | last post by:
Hi there, I have an application in which a grid of 100 or more buttons are put on a form in columns of 10. All the buttons are within a panel. They are added in runtime, and so they adopt a...
5
by: Rob | last post by:
If I use the following code: Private Sub Form1_KeyDown(ByVal sender As Object, _ ByVal e As System.Windows.Forms.KeyEventArgs) _ Handles MyBase.KeyDown Dim myKey As Integer myKey =...
1
by: Martijn Mulder | last post by:
/* I have problems detecting the Arrow Keys on a User Control. A control derived from System.Windows.Forms.Control neglects 'bare' Arrow Keys but does react on the combination <Altor <Ctrl+ Arrow...
0
by: Martijn Mulder | last post by:
/* I override IsInputKey() to direct the Arrow Keys (Cursor Keys) to my custom System.Windows.Forms.Control. But, holding down the Shift-Key prevents the Arrow Keys from coming through. How can...
6
by: tac-tics | last post by:
I've noticed that in Python 2.5, the interactive prompt does not support intelligent use of arrow keys like 2.4 did (up/down for previous/next statement, left/right for moving the cursor). What...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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...

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.