希望可以不显示开始时间,不显示耗时,根据起始时间和速度得到剩余时间。(希望得到代码)
def refresh_time(self):
time1=datetime.datetime.now()
temp=self.startTime.text()
temp2=temp[5:]
temp3=datetime.datetime.strptime(temp2, "%Y-%m-%d %H:%M:%S")
hour1=time1.hour-temp3.hour
minute1 = time1.minute - temp3.minute
second1=time1.second-temp3.second
if minute1<0:
hour1 =hour1 -1
minute1 = minute1*(-1)
if second1 < 0:
minute1 =minute1-1
second1 = second1 * (-1)
self.haoshi.setText(str(hour1)+"时"+str(minute1)+"分"+str(second1)+"秒")
def refresh_patient_info(self,data):
print("-------")
print(data)
if len(data) >0 :
self.num_bed.setText(data[0][1])
self.startTime.setText("开始时间:"+str(data[0][5]))
self.disu.setText(str(data[0][2])+'d/min')