Python 在使用tkinter和pymysql模块创建GUI应用程序时,我遇到了一个错误";TypeError:需要支持缓冲区API的对象“;?

Python 在使用tkinter和pymysql模块创建GUI应用程序时,我遇到了一个错误";TypeError:需要支持缓冲区API的对象“;?,python,mysql,user-interface,tkinter,pymysql,Python,Mysql,User Interface,Tkinter,Pymysql,我得到一个错误: Exception in Tkinter callback return self.func(*args) self._request_authentication() authresp = _auth.scramble_caching_sha2(self.password, self.salt) p1 = hashlib.sha256(password).digest() TypeError: object supporting the buffer API re

我得到一个错误:

Exception in Tkinter callback

return self.func(*args)

self._request_authentication()

authresp = _auth.scramble_caching_sha2(self.password, self.salt)

 p1 = hashlib.sha256(password).digest()

TypeError: object supporting the buffer API required
我的代码(学生表格):

from tkinter import *
from tkinter import messagebox
import pymysql

window = Tk()
window.geometry("300x200")
window.title("Student_Form")
window.resizable(0,0)
main_frame=Frame(window).place()

stud_id=IntVar()
seat=IntVar()
roll=IntVar()
name_s=StringVar()

# Insert
def insert():
    ent1=stud_id.get()
    ent2=seat.get()
    ent3=roll.get()
    ent4=name_s.get()


    if (ent1=="" or ent2=="" or ent3=="" or ent4==""):
        # print("Fill all")
        messagebox.showinfo("Insert status","All Fields Are Required")
    else:
        connection=pymysql.connect(host="localhost",user="root",passwd=77187718,db="student")
        cursors=connection.cursor()
        cursors.execute("insert into student values(%d,%d,%d,%s)",(ent1,ent2,ent3,ent4))
        cursors.close()
        connection.commit()

lable1 = Label(main_frame,text="Student_Id",font=("Arial", 10,"bold"),border=2,relief="solid",bg="sky blue",width=9).place(x=10,y=10)

entry1=Entry(main_frame,bd=2,bg="sky blue",font=("Arial", 11),textvariable=stud_id).place(x=100,y=10)
print(entry1)

lable2 = Label(main_frame,text="Seat_No",font=("Arial", 10,"bold"),border=2,relief="solid",bg="sky blue",width=9).place(x=10,y=40)

entry2=Entry(main_frame,bd=2,bg="sky blue",font=("Arial", 11),textvariable=seat).place(x=100,y=40)


lable3 = Label(main_frame,text="Roll_No",font=("Arial", 10,"bold"),border=2,relief="solid",bg="sky blue",width=9).place(x=10,y=70)

entry3=Entry(main_frame,bd=2,bg="sky blue",font=("Arial", 11),textvariable=roll).place(x=100,y=70)


lable4 = Label(main_frame,text="Name",font=("Arial", 10,"bold"),border=2,relief="solid",bg="sky blue",width=9).place(x=10,y=100)
entry4=Entry(main_frame,bd=2,bg="sky blue",font=("Arial", 11),textvariable=name_s).place(x=100,y=100)

insert_button = Button(text="Insert",width=35,command=insert).place(x=10,y=130)
insert_button = Button(text="Clear",width=10).place(x=95,y=160)



window.mainloop()

阿努拉格·达巴斯先生,我不习惯这个堆栈溢出,所以如果你有任何建议,请忽略这个,所以请告诉我。