def key_handler_func(sourceType, sourceIndex, key, value): #print(nameOf[key],"[",sourceIndex,"] =",value) print("key="+str(key),code_to_key(key),"[",sourceIndex,"] =",value) pass def syn_handler_func(sourceType, sourceIndex, code, value): #print("SYN",code,value) pass inputs = InputEvents( key_handler_func, mouse_handler_func, joystick_handler_func, syn_handler_func, unhandled_handler_func) #inputs = InputEvents(key_handler_func) while not inputs.key_state("KEY_ESC"): inputs.do_input_events() if inputs.key_state("KEY_LEFTCTRL"): inputs.grab_by_type("keyboard", grab=False) print("Name:",) s = raw_input() print("Hello",s) inputs.grab_by_type("keyboard", True) if inputs.key_state("BTN_LEFT"): v = inputs.get_mouse_movement() if v != (0,0,0,0,0): print(v) if inputs.key_state("BTN_RIGHT"): v = inputs.get_mouse_movement(1) if v != (0,0,0,0,0): print(v) if inputs.key_state("BTN_TOP2"): #gamepad L1 print(inputs.get_joystick()) #gamepad Left Analogue if inputs.key_state("BTN_BASE"): #gamepad R1
value) pass def syn_handler_func(sourceType, sourceIndex, code, value): #print("SYN",code,value) pass inputs = InputEvents(key_handler_func, mouse_handler_func, joystick_handler_func, syn_handler_func, unhandled_handler_func) #inputs = InputEvents(key_handler_func) while not inputs.key_state("KEY_ESC"): inputs.do_input_events() if inputs.key_state("KEY_LEFTCTRL"): inputs.grab_by_type("keyboard", grab=False) print("Name:", ) s = raw_input() print("Hello", s) inputs.grab_by_type("keyboard", True) if inputs.key_state("BTN_LEFT"): v = inputs.get_mouse_movement() if v != (0, 0, 0, 0, 0): print(v) if inputs.key_state("BTN_RIGHT"): v = inputs.get_mouse_movement(1) if v != (0, 0, 0, 0, 0): print(v) if inputs.key_state("BTN_TOP2"): #gamepad L1 print(inputs.get_joystick()) #gamepad Left Analogue if inputs.key_state("BTN_BASE"): #gamepad R1
if inFlag and abs(man.z() - building.zpos) > 55: inFlag = False for b in building.model: b.set_light(outLight, 0) mymap.set_light(outLight, 0) if inputs.key_state("KEY_APOSTROPHE"): #key ' tilt -= 2.0 if inputs.key_state("KEY_SLASH"): #key / tilt += 2.0 if inputs.key_state("KEY_A"): #key A rot += 2 if inputs.key_state("KEY_D"): #key D rot -= 2 if inputs.key_state("KEY_P"): #key P #record = not(record) while inputs.key_state("KEY_P"): inputs.do_input_events() # wait for key to go up screenshot("silo"+str(scshots)+".jpg") scshots += 1 if inputs.key_state("KEY_ENTER"): #key RETURN mc = 0 if inputs.key_state("KEY_X"): #key RETURN while inputs.key_state("KEY_X"): inputs.do_input_events() # wait for key to go up mouseOn != mouseOn inputs.grab_by_type("keyboard", grab=mouseOn) inputs.release() DISPLAY.destroy()