[Tutor] Curses example on Linux?

Hossein Movahhedian dma8hm1956 at gmail.com
Tue Aug 9 14:23:46 CEST 2005




   Dear Alan
   Hi,

   First of all let me thank you very much for that excellent
 tutorial. As a Python beginner, I learned many things from that.
   As I have mentioned in my previous message to this list, in
 that example I had to replace "ky = msvcrt.getch()" with
 "ky = chr(msvcrt.getch())". The other problem is that when
 the program is finished the previous terminal state is not
 restored (I am using xterm on Linux).
   Finally, I noticed a typo in the example "class Message" in
 section Object Oriented Programming. __init__ is written __inti__
 in "def __inti__(self, aString):".

Regards,
Hossein

On Tue, 9 Aug 2005, Alan G <alan.gauld at freenet.co.uk> wrote:

> >>    I have copied the following example from "Learning to Program by
> >> Alan
> >>  Gauld (section: Event Driven Programming)". To run it on Linux
> >>  (Redhat 8.0; Python 2.4) the tutorial says to replace 'msvcrt'
> >>  with 'curses.stdscr'.
>
> I thought I'd fixed that fault.
>
> The sequence should be:
>
> import curses
> mscvrt = curses.initscr()
> mscvcrt.getch()
>
>
> I will make the changes and upload the fixed file as soon as possible.
>
>
> Thanks for bringing it up.
>
> Alan G
> Author of the Learn to Program web tutor
> http://www.freenetpages.co.uk/hp/alan.gauld
>
> >
> >
> > Hi Hossein,
> >
> >
> > According to:
> >
> >    http://www.amk.ca/python/howto/curses/
> >
> >
> > Alan probably meant to say to replace:
> >
> > ######
> > import msvcrt
> > ######
> >
> > with:
> >
> > ######
> > import curses
> > msvcrt = curses.initscr()
> > ######
> >
> > as a quick hack to replace 'msvcrt' with something that works on
> > Linux.
> >
> >
> > It sounded that you wanted to look at other examples of curses
> > programming?  A long time ago, I wrote a quick-and-dirty demo
> > program that
> > uses curses here:
> >
> >    http://hkn.eecs.berkeley.edu/~dyoo/python/circularwriting.py
> >
> >
> > Good luck to you!
> >
> >
> >
>


More information about the Tutor mailing list