def newFoodIns(self,delta):
t = date.today() - timedelta(delta)
try:
realKcal = float(self.kcalInp.text)*float(self.portionInp.text)
c.execute("INSERT INTO foods(name,date,kcal,portion) VALUES(?,?,?,?);",
(self.foodInp.text,t,realKcal,int(self.portionInp.text)))
db.commit()
CalApp.updateJournal(delta)
CalApp.sm.current = 'Root'
except ValueError:
invalid = Popup(title='Invalid entries',
content=Label(text='Check your data and try again.'),
size_hint=(None, None),size=('250dp','150dp'))
invalid.open()
评论列表
文章目录