def changePara(): write = ['N/A'] * 4 d = 0 write[0] = LRL_roll.get() write[1] = URL_roll.get() if int(write[0]) > int(write[1]): tkinter.messagebox.showerror( 'Error', 'Lower Rate Limit cannot be bigger than Upper Rate Limit') else: write[2] = AA_roll.get() aoo_aa_p = AA_roll.get() if aoo_aa_p == 'OFF': aoo_aa_p = 0 else: aoo_aa_p = int(100 * float(aoo_aa_p)) write[3] = APW_roll.get() if checkConnect() == 6: connectLable.set("No Pacemaker Connected") label = tk.Label(root_AOO, textvariable=connectLable, font=("Times New Roman", 14), fg="red").place(x=10, y=40) label = tk.Label(paraWindow, textvariable=connectLable, font=("Times New Roman", 14), fg="red").place(x=10, y=40) tkinter.messagebox.showerror( 'Error', 'Failed to connect to the Pacemaker') else: connectLable.set("Pacemaker is Connected") label = tk.Label(root_AOO, textvariable=connectLable, font=("Times New Roman", 14), fg="green").place(x=10, y=40) label = tk.Label(paraWindow, textvariable=connectLable, font=("Times New Roman", 14), fg="green").place(x=10, y=40) writePara(mode=1, Lower_Rate=int(LRL_roll.get()), ATR_Amplitude=int(aoo_aa_p), ATR_Width=int(APW_roll.get())) with open("parameterAOO.txt", "w") as parameterFile: while (d < 4): parameterFile.write( write[d] + "\n") #Write every index of list write[] into file d += 1 d = 0 lrlLabel.set(write[0]) urlLabel.set(write[1]) aaLabel.set(write[2]) apwLabel.set(write[3]) paraWindow.destroy()
def changePara(): write = ['N/A'] * 13 p = 0 write[0] = LRL_roll.get() write[1] = URL_roll.get() if int(write[0]) > int(write[1]): tkinter.messagebox.showerror( 'Error', 'Lower Rate Limit cannot be bigger than Upper Rate Limit') else: write[2] = AA_roll.get() aair_aa_p = AA_roll.get() if aair_aa_p == 'OFF': aair_aa_p = 0 else: aair_aa_p = int(100 * float(aair_aa_p)) write[3] = APW_roll.get() write[4] = MSR_roll.get() write[5] = AT_roll.get() aair_at_p = AT_roll.get() if aair_at_p == 'V-Low': aair_at_p = 0.5 elif aair_at_p == 'Low': aair_at_p = 1.0 elif aair_at_p == 'Med-Low': aair_at_p = 1.5 elif aair_at_p == 'Med': aair_at_p = 1.75 elif aair_at_p == 'Med-High': aair_at_p = 2.0 elif aair_at_p == 'High': aair_at_p = 2.5 elif aair_at_p == 'V_High': aair_at_p = 3.0 write[6] = REAC_roll.get() aair_reac_p = REAC_roll.get() if aair_reac_p == '5(Test)': aair_reac_p = 5 write[7] = RF_roll.get() write[8] = RECO_roll.get() aair_reco_p = RECO_roll.get() if aair_reco_p == '0.1(Test)': aair_reco_p = 6 else: aair_reco_p = 60 * int(aair_reco_p) write[9] = AS_roll.get() write[10] = ARP_roll.get() write[11] = PVARP_roll.get() write[12] = RS_roll.get() if checkConnect() == 6: connectLable.set("No Pacemaker Connected") label = tk.Label(root_AAIR, textvariable=connectLable, font=("Times New Roman", 14), fg="red").place(x=10, y=40) label = tk.Label(paraWindow, textvariable=connectLable, font=("Times New Roman", 14), fg="red").place(x=10, y=40) tkinter.messagebox.showerror( 'Error', 'Failed to connect to the Pacemaker') else: connectLable.set("Pacemaker is Connected") label = tk.Label(root_AAIR, textvariable=connectLable, font=("Times New Roman", 14), fg="green").place(x=10, y=40) label = tk.Label(paraWindow, textvariable=connectLable, font=("Times New Roman", 14), fg="green").place(x=10, y=40) writePara(mode = 9, Lower_Rate = int(LRL_roll.get()), MSR = int(MSR_roll.get()), ATR_Amplitude = int(aair_aa_p), ATR_Width = int(APW_roll.get()), \ ATR_Refractory = int(ARP_roll.get()), Activity_Threshold = aair_at_p, Reaction_Time = int(aair_reac_p), Response_Factor = int(RF_roll.get()), \ Recovery_Time = int(aair_reco_p)) with open("parameterAAIR.txt", "w") as parameterFile: while (p < 13): parameterFile.write( write[p] + "\n") #Write every index of list write[] into file p += 1 p = 0 lrlLabel.set(write[0]) urlLabel.set(write[1]) aaLabel.set(write[2]) apwLabel.set(write[3]) msrLabel.set(write[4]) atLabel.set(write[5]) reacLabel.set(write[6]) rfLabel.set(write[7]) recoLabel.set(write[8]) asLabel.set(write[9]) arpLabel.set(write[10]) pvarpLabel.set(write[11]) rsLabel.set(write[12]) paraWindow.destroy()
def changePara(): write = ['N/A'] * 7 d = 0 write[0] = LRL_roll.get() write[1] = URL_roll.get() if int(write[0]) > int(write[1]): tkinter.messagebox.showerror( 'Error', 'Lower Rate Limit cannot be bigger than Upper Rate Limit') else: write[2] = VA_roll.get() vvi_va_p = VA_roll.get() if vvi_va_p == 'OFF': vvi_va_p = 0 else: vvi_va_p = int(100 * float(vvi_va_p)) write[3] = VPW_roll.get() write[4] = VS_roll.get() write[5] = VRP_roll.get() write[6] = RS_roll.get() if checkConnect() == 6: connectLable.set("No Pacemaker Connected") label = tk.Label(root_VVI, textvariable=connectLable, font=("Times New Roman", 14), fg="red").place(x=10, y=40) label = tk.Label(paraWindow, textvariable=connectLable, font=("Times New Roman", 14), fg="red").place(x=10, y=40) tkinter.messagebox.showerror( 'Error', 'Failed to connect to the Pacemaker') else: connectLable.set("Pacemaker is Connected") label = tk.Label(root_VVI, textvariable=connectLable, font=("Times New Roman", 14), fg="green").place(x=10, y=40) label = tk.Label(paraWindow, textvariable=connectLable, font=("Times New Roman", 14), fg="green").place(x=10, y=40) writePara(mode=4, Lower_Rate=int(LRL_roll.get()), VENT_Amplitude=int(vvi_va_p), VENT_Width=int(VPW_roll.get()), VENT_Refractory=int(VRP_roll.get())) with open("parameterVVI.txt", "w") as parameterFile: while (d < 7): parameterFile.write( write[d] + "\n") #Write every index of list write[] into file d += 1 d = 0 lrlLabel.set(write[0]) urlLabel.set(write[1]) vaLabel.set(write[2]) vpwLabel.set(write[3]) vsLabel.set(write[4]) vrpLabel.set(write[5]) rsLabel.set(write[6]) paraWindow.destroy()