Python - getch() and kbhit()

Python - getch() and kbhit()

Shlomo Solomon shlomo.solomon at gmail.com
Tue Jan 9 12:40:59 IST 2018


Hi Shlomi,
Thanks for your feedback - my reply below.

On Tue, 9 Jan 2018 12:21:51 +0200
Shlomi Fish <shlomif at gmail.com> wrote:

> Hi Shlomo,
> 
> On Tue, Jan 9, 2018 at 10:36 AM, Shlomo Solomon
> <shlomo.solomon at gmail.com> wrote:
> 
> > Since import msvcrt in Python is Windows specific, I adapted some
> > code I found to provide kbhit() and getch() in Python under Linux.
> >
> > I'm attaching KBHIT.py which replaces msvcrt and a small program to
> > demonstrate how to use it - KBHIT-test.py.
> >
> > The KBHIT.py documentation includes usage instructions and also a
> > link to the code I borrowed and (I hope) improved.
> >
> >
> thanks for your contribution.
> 
> some comments:
> 
> 1. What is the licence of the code? See
> https://www.mail-archive.com/perl6-users@perl.org/msg04541.html .

Note the following statement in the code (was already in the code I
"borrowed" and I felt it would be wrong/dis-honest to change it):
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as 
published by the Free Software Foundation, either version 3 of the 
License, or (at your option) any later version.

> 
> 2. Please use a PyPI-like distribution format, see
> https://github.com/ofek/hatch or
> https://github.com/audreyr/cookiecutter-pypackage .

You're probably right, but since this was just something I hacked
together to solve a specific problem I was having, I didn't really see
the need to "formalize" it.

> 
> 3. For more best practices, see
> https://github.com/shlomif/Freenode-programming-channel-FAQ/blob/master/FAQ.mdwn#what-are-some-best-practices-in-programming-that-i-should-adopt
> .
> 
> 4. -test.py should be -example.py
> 
> 
> >
> > --
> > Shlomo Solomon
> > http://the-solomons.net
> > Claws Mail 3.11.1 - KDE 4.14.30 - Dolphin 4.14.3 - LINUX Mageia 5
> > _______________________________________________
> > Linux-il mailing list
> > Linux-il at cs.huji.ac.il
> > http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
> >
> >
> 
> 



-- 
Shlomo Solomon
http://the-solomons.net
Claws Mail 3.11.1 - KDE 4.14.30 - Dolphin 4.14.3 - LINUX Mageia 5



More information about the Linux-il mailing list