Re: [Tutor] how do we represent left arrow key in python programming.

2009-08-21 Thread Luke Paireepinart
you're gonna have to be a lot more specific than that if you want a decent
answer.

On Fri, Aug 21, 2009 at 4:45 AM, Ajith Gopinath qbits...@gmail.com wrote:

 Hi Folks,
 how do we represent left arrow key in a python program?
 Can anybody help?
 || a j i t ||

 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] how do we represent left arrow key in python programming.

2009-08-21 Thread Ajith Gopinath
Hi,
I just want to travese a text based menu.My prog.  will login to a text
based app. and traverse its menu  and clicks  where i want to be. rit now i
find it sifficult to traverse the menu.I am but able to click on the very
first item.Will this info help?
|| a j i t ||


On Fri, Aug 21, 2009 at 3:28 PM, Luke Paireepinart
rabidpoob...@gmail.comwrote:

 you're gonna have to be a lot more specific than that if you want a decent
 answer.

 On Fri, Aug 21, 2009 at 4:45 AM, Ajith Gopinath qbits...@gmail.comwrote:

 Hi Folks,
 how do we represent left arrow key in a python program?
 Can anybody help?
 || a j i t ||

 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] how do we represent left arrow key in python programming.

2009-08-21 Thread Alan Gauld


Ajith Gopinath qbits...@gmail.com wrote 


how do we represent left arrow key in a python program?
Can anybody help?


That depends entirely on your terminal/environment.
If you are using a Unix terminal it will be diffeent to using 
a Mac or a PC.


You can write a program to display the key code of any 
key using curses on *nix or msvcrt on Windows. Here
is an example from my web tutor under the Event Driven 
Programming topic...


import msvcrt

def doKeyEvent(key):
   if key == '\x00' or key == '\xe0': # non ASCII
  key = msvcrt.getch() # fetch second character
   print ord(key),

def doQuitEvent(key):
   raise SystemExit


# First, clear the screen of clutter then warn the user 
# of what to do to quit

lines = 25 # set to number of lines in console
for line in range(lines): print

print Hit space to end...
print

# Now mainloop runs forever
while True:
  ky = msvcrt.getch()
  length = len(ky)
  if length != 0:
 # send events to event handling functions
 if ky ==  : # check for quit event
doQuitEvent(ky)
 else: 
doKeyEvent(ky)

HTH,


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] how do we represent left arrow key in python programming.

2009-08-21 Thread Eike Welk
On Friday 21 August 2009, Ajith Gopinath wrote:
 Hi,
 I just want to travese a text based menu.My prog.  will login to a
 text based app. and traverse its menu  and clicks  where i want to
 be. rit now i find it sifficult to traverse the menu.I am but able
 to click on the very first item.Will this info help?

You should look at the curses library for complex, but text based 
interfaces. I don't know if it exists on Windows though:
http://docs.python.org/library/curses.html

HTH, Eike.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor