[Linux-Biella] su raspberry keypress in python

PaulTT paultt a bilug.it
Gio 17 Gen 2019 17:07:51 CET


On 17/01/19 17:05, Leonardo wrote:
>
> On 17/01/19 17:00, PaulTT wrote:
>> On 17/01/19 16:29, Leonardo wrote:
>>>
>>> ciao
>>>
>>> avrei necessita' di "sentire" quando, mentre sono in ssh, viene 
>>> premuto un tasto (e ovviamente riconoscerlo)
>>>
>>> praticamente mi serve per poter lavorare in SSH su un sistema remoto 
>>> dove c'e' un encoder che se mi trovo localmente posso smanettarci, 
>>> se sono lontano diventa un po' difficile
>>>
>>> quindi in parallelo all'encoder devo poter "sentire" se premo un 
>>> tasto (qualunque) piuttosto che un altro per simulare la rotazione a 
>>> destra o a sinistra
>>>
>>> ovviamente il tasto non sara' un input seguito da un CR ma 
>>> semplicemente la pressione di un generico tasto come avverebbe ad 
>>> esempio un bash con
>>>
>>> read -n 1
>>>
>>>
>>> qualcuno mi sa aiutare?
>>
>>
>> https://stackoverflow.com/questions/24072790/detect-key-press-in-python
>>
>> xoxo by duckduckgo
>
>
> gia' lo stesso risultato l'avevo ottenuto anche usando google
>
> se poi provi a fare import keyboard dice che non esiste, devi usare 
> pip, infatti trovi che:
>
> https://stackoverflow.com/questions/46219800/python-module-keyboard-works-on-windows-not-found-on-raspberry 
>
>
> quindi devi pip installare keyboard
>
>
> il fatto e' che essendo il sistema della domotica vorrei evitare di 
> installare due pacchetti:
>

e allora installa a mano keyboard

>
> root a domotica:/opt/bin# apt install python-pip
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> The following additional packages will be installed:
>   gir1.2-glib-2.0 libdbus-glib-1-2 libexpat1-dev libgirepository-1.0-1
>   libpython-all-dev libpython-dev libpython2.7 libpython2.7-dev 
> python-all
>   python-all-dev python-cffi-backend python-crypto python-cryptography
>   python-dbus python-dev python-enum34 python-gi python-idna 
> python-ipaddress
>   python-keyring python-keyrings.alt python-pip-whl python-pkg-resources
>   python-pyasn1 python-secretstorage python-setuptools python-six 
> python-wheel
>   python-xdg python2.7-dev
> Suggested packages:
>   python-crypto-dbg python-crypto-doc python-cryptography-doc
>   python-cryptography-vectors python-dbus-dbg python-dbus-doc
>   python-enum34-doc python-gi-cairo gnome-keyring libkf5wallet-bin
>   gir1.2-gnomekeyring-1.0 python-fs python-gdata python-kde4 
> python-keyczar
>   doc-base python-secretstorage-doc python-setuptools-doc
> The following NEW packages will be installed:
>   gir1.2-glib-2.0 libdbus-glib-1-2 libexpat1-dev libgirepository-1.0-1
>   libpython-all-dev libpython-dev libpython2.7 libpython2.7-dev 
> python-all
>   python-all-dev python-cffi-backend python-crypto python-cryptography
>   python-dbus python-dev python-enum34 python-gi python-idna 
> python-ipaddress
>   python-keyring python-keyrings.alt python-pip python-pip-whl
>   python-pkg-resources python-pyasn1 python-secretstorage 
> python-setuptools
>   python-six python-wheel python-xdg python2.7-dev
> 0 upgraded, 31 newly installed, 0 to remove and 0 not upgraded.
>
>
>>
>>
> _______________________________________________
> Linux mailing list
> Linux a list.bilug.it
> https://list.bilug.it/listinfo/linux


-- 
It is a good day to die. But the day is not yet over.



Maggiori informazioni sulla lista Linux