Код: Выделить всё
def skip_cell_discharge():
global after_id_cell_discharge
if after_id_cell_discharge is not None: CELL_DISCHARGE_frame.after_cancel(after_id_cell_discharge)
EDLC_DOUBLE_CC_CHARGE()
Код: Выделить всё
def countdown(count):
global Chroma_address
global DAQ_address
global after_id_cell_discharge
rm = pyvisa.ResourceManager()
myChroma = rm.open_resource(Chroma_address)
my34970A = rm.open_resource(DAQ_address)
voltage_label = ttk.Label(CELL_DISCHARGE_frame)
voltage_label.grid(row=2, column=0, pady=10)
progress = ttk.Progressbar(CELL_DISCHARGE_frame, orient="horizontal", length=180, mode="determinate")
progress.grid(row=1, column=0, pady=10)
progress["maximum"] = 180
if count > 0:
progress["value"] = 180 - count
CELL_DISCHARGE_frame.update_idletasks()
print(str(count) + ": Seconds Remaining - initial discharge")
max_range = Num_samples + 101
for t in range(101,max_range,1):
code = 200 + (t)
print(code)
#serialcomm.write(str(code).encode())
my34970A.write('MEAS:VOLTAGE:DC? AUTO, DEF, (@' + str(t) + ')')
voltage = float(my34970A.read())
print("Voltage for Channel " + str(t) + " = " + str(voltage) + " VDC")
voltage_label.config(text="Voltage: " + str(voltage))
CELL_DISCHARGE_frame.update_idletasks()
if msvcrt.kbhit():
ASCII_in = ord(msvcrt.getche())
if ASCII_in == 120:
EDLC_DOUBLE_CC_CHARGE()
after_id_cell_discharge = CELL_DISCHARGE_frame.after(1000, countdown, count -1)
else:
EDLC_DOUBLE_CC_CHARGE()
Подробнее здесь: https://stackoverflow.com/questions/792 ... s-expected