MySQL表中填写的空条目-Python>;编程 MySQL表中填充的空条目(Python+Tkinter)

MySQL表中填写的空条目-Python>;编程 MySQL表中填充的空条目(Python+Tkinter),python,mysql,tkinter,Python,Mysql,Tkinter,MySQL中存在数据输入问题。在输入时,它不会从我或 用户。还有一件事我想添加多个页面。但我如何才能使按钮提交的价值和直接到第2页。如果有人知道,请告诉我。 多谢各位 我不知道这是否是问题所在,但肯定有一个问题是多次调用mainloop。您不应多次调用mainloop。另一个问题似乎是,在用户有机会输入任何数据之前,您正在调用数据库连接() from tkinter import * import mysql.connector from PIL import Image,ImageTk

MySQL中存在数据输入问题。在输入时,它不会从我或 用户。还有一件事我想添加多个页面。但我如何才能使按钮提交的价值和直接到第2页。如果有人知道,请告诉我。 多谢各位


我不知道这是否是问题所在,但肯定有一个问题是多次调用
mainloop
。您不应多次调用
mainloop
。另一个问题似乎是,在用户有机会输入任何数据之前,您正在调用
数据库连接()
from tkinter import * 
import mysql.connector
from PIL import Image,ImageTk

m=Tk()
button_bg='#FF9200'
button_fg='#fff'
active_button_fg='#FF9200'
active_button_bg='#fff'


def tkinter_setup():
    m.geometry('1024x720')




def database_connectivity():

    FullName=StringVar()
    CollegeName=StringVar()
    Email = StringVar()
    Password=IntVar()
    CGPA= IntVar()

    fullName=FullName.get()
    collegeName=CollegeName.get()
    email=Email.get()
    password=Password.get()
    cgpa=CGPA.get()

    
    mydb = mysql.connector.connect(host="localhost", user="root", passwd="ashu12",database='mySchool')
    cursor=mydb.cursor()
    cursor.execute('CREATE TABLE IF NOT EXISTS Student (FullName TEXT,CollegeName TEXT,Email TEXT,Password INT,CGPA INT)')
    cursor.execute('INSERT INTO Student (FullName,CollegeName,Email,Password,CGPA) VALUES(%s,%s,%s,%s,%s)',(fullName,collegeName,email,password,cgpa))
    mydb.commit()

def page2():
    entry7 = Entry(m,width=70)
    entry7.place(x=0,y=30)
    entry7.insert(0,'Full Name')
    m.mainloop()



def page1():

    Image_open=Image.open("1.png")
    image=ImageTk.PhotoImage(Image_open)
    logo=Label(m,image=image)
    logo.place(x=0,y=0,bordermode="outside")

    entry1 = Entry(m,textvar='FullName',font="Ubuntu")
    entry1.place(height=45,width=397,x=145,y=154)

    entry1 = Entry(m,width=42,textvar='Collegename',font="Ubuntu")
    entry1.place(height=45,width=397,x=145,y=210)

    entry1 = Entry(m,width=42,textvar='Email',font="Ubuntu")
    entry1.place(height=45,width=397,x=145,y=266)

    entry1 = Entry(m,width=42,textvar='Password',font="Ubuntu")
    entry1.place(height=45,width=397,x=145,y=322)    
    
    entry1 = Entry(m,width=42,textvar='CGPA',font="Ubuntu")
    entry1.place(height=45,width=397,x=145,y=377)
    
    
    button = Button(m,text='Registration' , bg=button_bg,foreground=button_fg,activebackground=active_button_bg,activeforeground=active_button_fg,command=page2 )
    button.place(height=47, width=399 ,x=144,y=476)
    m.mainloop()





tkinter_setup()
database_connectivity()
page1()
page2()