free software resistance
the cost of computing freedom is eternal vigilance
### qin.py
*original date:* oct 2014
*orginally posted:* sep 2024
getting a single keypress from python is tricky, unless youre using a library. since i was showing people how to do basic things from python, i made a routine to get a keypress from the shell- i didnt say it was a particularly good routine:
```
def qinputs():
import os
pr = os.popen("bash -c \"read -n 1 p ; echo \\$p\"")
pr = pr.read().replace("\n","")
if pr == chr(32): pr = "S"
pr = pr.strip()
if pr == u"\u007f": pr = chr(9)
if len(pr) > 1: pr = pr[0]
return pr
print "+" + qinputs() * 5 + "+"
```
license: 0-clause bsd
```
# 2014 mn
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
```
=> https://freesoftwareresistance.neocities.org