          return vals.index(ord(char.decode("utf-8")))
  
      def kbhit(self):
          """ Returns True if keyboard character was hit, False otherwise. """
          if self.is_gui and os.name != "nt" or not sys.stdout.isatty():
              return None
          if os.name == "nt":
              return msvcrt.kbhit()
          d_r, _, _ = select([sys.stdin], [], [], 0)
          return d_r != []
 
</s> remove         if self.is_gui or not sys.stdout.isatty():
 </s> add         if (self.is_gui or not sys.stdout.isatty()) and os.name != "nt": </s> remove         if self.is_gui and os.name != "nt" or not sys.stdout.isatty():
 </s> add         if (self.is_gui or not sys.stdout.isatty()) and os.name != "nt":
        if (self.is_gui or not sys.stdout.isatty()) and os.name != "nt":
          return vals.index(ord(char.decode("utf-8")))
  
      def kbhit(self):
          """ Returns True if keyboard character was hit, False otherwise. """
        if (self.is_gui or not sys.stdout.isatty()) and os.name != "nt":
              return None
          if os.name == "nt":
              return msvcrt.kbhit()
          d_r, _, _ = select([sys.stdin], [], [], 0)
          return d_r != []
keep keep keep keep replace keep keep keep keep keep
 bugfix: Windows - Stop training when terminate button pressed 
lib/keypress.py