file.close() def UpdateWrite(): global Serial global Curr_Id file = open('Users.txt',mode = 'a') file2= open('curr.txt',mode='w') for a in Serial: file.write(',') file.write(str(a)) file.close() file2.write(str(Curr_Id)) file2.close() def press(key): global IgnoreLoops global Speed while key == char_w: SmartCam.Static = False SmartCam.GUI.UpdateGUI(key) if Speed<10: Speed = Speed + 0.1 if Speed >= 10: Speed = Speed + (0.003*Speed) if Speed >=180: key = None def release(key): global action global Speed global Curr_Id global prev_keyu if key == char_u: SmartCam.action = key prev_key = key if key == char_plus and prev_key == char_u: UpdateRead() ManageUsers.addUser(Curr_Id) Serial.add(Curr_Id) Curr_Id = Curr_Id + 1 UpdateWrite() if key == char_e: SmartCam.Create = true if key == char_minus and prev_key == char_u: UpdateRead() a = input('Enter User Id') Curr_Id = int(a) if Curr_Id in Serial: ManageUsers.removeUser(Curr_Id) else: pass if key == char_q: SmartCam.GUI.UpdateGUI(key) SmartCam.Access = False SmartCam.came = False SmartCam.Static = True SmartCam.GUION = False if key == char_s: Speed = 0 SmartCam.Static = True def handler(): with Listener(on_press=press,on_release=release) as listen: listen.join()
def addUser(*args): import ManageUsers ManageUsers.addUser().call(*args)