get_keys.py

Created by julien-bernon

Created on June 20, 2022

509 Bytes

from https://my.numworks.com/python/andreanx/getkeys


from kandinsky import *
from random import randrange,random
from ion import *
import time

def keycodes():
  lc = list(range(0,6)) + list(range(12,35))
  for k in range(36,53):
    if (k+1)%6:
      lc.append(k)
  return lc

def getkey():
  for k in keycodes():
    if keydown(k):
      return k
  return -1

def getkeys():
  lk = []
  for k in keycodes():
    if keydown(k):
      lk.append(k)
  return lk 


while True:
    lk=getkeys()
    for i in lk:
        print(i)
    time.sleep(0.5)