from datetime import datetime
from tkinter import *
root = Tk()
root.title("Запись давления")
root.geometry('300x200+200+200')
pressure = StringVar()
pulse = StringVar()
datetime = datetime.now()
lbl1 = Label(root,text="Давление")
ent1 = Entry(textvariable=pressure, font=17)
lbl2 = Label(root,text="Пульс")
ent2 = Entry(textvariable=pulse, font=17)
lbl1.pack()
ent1.pack()
lbl2.pack()
ent2.pack()
def write(pulse,pressure,datetime):
with open("pulse.txt", "w") as file:
file.write(pulse)
butt = Button(root,text="Записать", command='write')
butt.pack()
root.mainloop()
from functools import partial
def write(pulse, pressure, datetime):
with open("pulse.txt", "w") as file:
file.write(pulse.get())
butt = Button(root, text="Записать", command=partial(write, pulse, pressure, datetime))
from datetime import datetime
from tkinter import *
from functools import partial
root = Tk()
root.title("Запись давления")
root.geometry('300x200+200+200')
pressure = StringVar()
pulse = StringVar()
datetime = datetime.now()
lbl1 = Label(root,text="Давление")
ent1 = Entry(textvariable=pressure, font=17)
lbl2 = Label(root,text="Пульс")
ent2 = Entry(textvariable=pulse, font=17)
lbl1.pack()
ent1.pack()
lbl2.pack()
ent2.pack()
def write(pulse, pressure, datetime):
with open("pulse.txt", "w") as file:
data = "Время: {0}\nПульс: {1}\nДавление: {2}".format(datetime, pulse.get(), pressure.get())
file.write(data)
butt = Button(root,text="Записать", command=partial(write, pressure, pulse, datetime))
butt.pack()
root.mainloop()