class AbstractGamepad(object):
    UP = 11
    DOWN = 12
    LEFT = 13
    RIGHT = 14

    btn_count = 15

    def __init__(self, verbose=False):
        self.verbose = verbose
        self.button = [False for i in range(self.btn_count)]

        self.on_press = []
        self.on_release = []

    def press(self, btn):
        self.button[btn] = True
        if self.verbose:
            print('Pressed ' + str(btn))
        for callback in self.on_press:
            callback(btn)

    def release(self, btn):
        self.button[btn] = False
        if self.verbose:
            print('Released ' + str(btn))
        for callback in self.on_release:
            callback(btn)

    def tick(self):
        pass

@@ -307,32 +307,49 @@
 ess(self, btn):%0A
+        try:%0A    
         self.but
@@ -364,32 +364,36 @@
  = True%0A        
+    
 if self.verbose:
@@ -401,24 +401,28 @@
             
+   
+ 
 print('Press
@@ -430,32 +430,36 @@
 d ' + str(btn))%0A
+    
         for call
@@ -485,32 +485,36 @@
 ss:%0A            
+   
+ 
 callback(btn)%0A%0A 
@@ -502,32 +502,125 @@
    callback(btn)
+%0A        except TypeError:%0A            # don't crash on unexpected key-codes%0A            pass
 %0A%0A    def releas
@@ -625,32 +625,49 @@
 ase(self, btn):%0A
+        try:%0A    
         self.but
@@ -683,32 +683,36 @@
 = False%0A        
+    
 if self.verbose:
@@ -720,24 +720,28 @@
             
+   
+ 
 print('Relea
@@ -750,32 +750,36 @@
 d ' + str(btn))%0A
+    
         for call
@@ -807,32 +807,36 @@
 se:%0A            
+   
+ 
 callback(btn)%0A%0A 
@@ -832,16 +832,109 @@
 ack(btn)
+%0A        except TypeError:%0A            # don't crash on unexpected key-codes%0A            pass
 %0A%0A    de

fix nonetype key inputs