Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

raspberry pi keyboard python input

import tty, sys, termios

filedescriptors = termios.tcgetattr(sys.stdin)
tty.setcbreak(sys.stdin)
x = 0
while 1:
  x=sys.stdin.read(1)[0]
  print("You pressed", x)
  if x == "r":
    print("If condition is met")
termios.tcsetattr(sys.stdin, termios.TCSADRAIN,filedescriptors)
Comment

PREVIOUS NEXT
Code Example
Python :: numpy array split 
Python :: django include 
Python :: pyplot savefig 
Python :: how to run python file 
Python :: how can i plot graph from 2 dataframes in same window python 
Python :: findout not common values between two data frames 
Python :: create pandas dataframe from dictionary 
Python :: pyqt5 image center 
Python :: python working directory 
Python :: python sort dictionary by value 
Python :: read value from entry tkinter 
Python :: sort first element reverse sort second python 
Python :: python capitalize every first letter 
Python :: Find All Occurrences of a Substring in a String in Python 
Python :: python print value and variable name 
Python :: read file csv in python 
Python :: Game of Piles Version 2 codechef solution 
Python :: filter in pandas 
Python :: copy files to a directory using text file 
Python :: detect character in string python 
Python :: python program to print ASCII characters in lowercase 
Python :: php echo shorthand 
Python :: django form list option 
Python :: how to define piecewise function i python 
Python :: django get parameters from url 
Python :: print A to z vy using loop in python 
Python :: find all regex matches python 
Python :: make legend box transparent in matplotlib 
Python :: handwriting python 
Python :: python print format 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =