for i, st in enumerate(str_list):
      st.set_material(str_colours[i, 0])
      st.scale(0.5 + outlayer[i], 1.0, 1.0)
    ready_flag = False

  k = mykeys.read()
  if k >-1:
    if k == 27:
      break
    if k >= ord('1') and k <= ord('5'): # do training
      trained = True
      i = k - ord('1')
      targets = np.zeros((5,), dtype=np.float)
      targets[i] = 1.0
      presses[i] += 1
      print('{} {},{},{},{},{}'.format(mlp.back_propagate(targets, learning_rate=0.05), *presses))

  ''' NB uncomment below with care; this will generate a lot of images very 
  quickly! Also you obviously need a viable path rather than the one below 
  which will only match the USB drive I happen to be using.
  '''
  #pi3d.screenshot("/media/pi/701E-64FC/tmp/scr_cap/fr{:05d}.jpg".format(fr))
  #fr += 1

mykeys.close()
DISPLAY.destroy()
if trained:
  np.save('wi_file.npy', mlp.wi)
  np.save('wo_file.npy', mlp.wo)
  try:
    with open('presses.txt','r') as f: