一个类里面__init__方法和其他方法中值的使用

class InsertFrame(tk.Frame):
def init(self, root):
super().init(root)
li = tk.StringVar()
pre1 = tk.StringVar()
pre2 = tk.StringVar()
su = tk.StringVar()
he = tk.StringVar()
tk.Button(self, text='血脂中甘油三酯').grid(row=4, pady=10, column=1)
tk.Entry(self, textvariable=li).grid(row=4, column=2)
tk.Button(self, text='舒张压').grid(row=5, pady=10, column=1)
tk.Entry(self, textvariable=pre1).grid(row=5, column=2)
tk.Button(self, text='收缩压').grid(row=6, pady=10, column=1)
tk.Entry(self, textvariable=pre2).grid(row=6, column=2)
tk.Button(self, text='血糖').grid(row=7, pady=10, column=1)
tk.Entry(self, textvariable=su).grid(row=7, column=2)
tk.Button(self, text='心率').grid(row=8, pady=10, column=1)
tk.Entry(self, textvariable=he).grid(row=8, column=2)

    def loe():
        self.__init__()
        lii = li.get()
        pre11 = pre1.get()
        pre22 = pre2.get()
        suu = su.get()
        hee = he.get()
        flag, message = db.all(li, pre1, pre2, su, he)
        if flag:
            print('登录成功')
        else:
            messagebox.showwarning(title='警告', message=message)


    tk.Button(self, text='提交', command=loe).grid(row=15, column=2)

结果报错
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\18392\AppData\Local\Programs\Python\Python38\lib\tkinter_init_.py", line 1883, in call
return self.func(*args)
File "D:\py\pythonProject1\views.py", line 47, in loe
self.init()
TypeError: init() missing 1 required positional argument: 'root'

函数loe()里的self.init()少传了一个参数root

TypeError里不都已经说的很清楚了,少传了一个参数root,我无非帮你翻译一下