Вот страница входа
import tkinter
from tkinter import *
from tkinter import messagebox
from tkinter.messagebox import showinfo
import mysql.connector
win=Tk()
win.title("AirWaves")
win.geometry('1366x768')
win.geometry("+100+50")
win.configure(bg="#fff")
win.resizable(False,False)
def clear():
uentry.delete(0, END)
pentry.delete(0, END)
def login():
db=mysql.connector.connect(host="localhost", database='jagran', user='root', password='1074')
cur=db.cursor()
cur.execute("select * from passengers where username = (%s) and password = (%s)", (uentry.get(),pentry.get()))
if (cur.fetchone()):
messagebox.showinfo("
win.destroy()
import app
else:
messagebox.showerror("Login Failed
def signup():
win.destroy()
import signup
img = PhotoImage(file="airplane aesthetics.png", master=win)
Label(win,image=img,bg='white', anchor="nw").place(x=-2,y=-2)
h1 = Label(win , text = "AirWaves" , font = 'Perpetua 80 bold', bg="#fff")
h1.place(x=770 , y=60)
h2 = Label(win , text = "Airline Reservation System" , font = 'Perpetua 30 bold', bg="#fff")
h2.place(x=755 , y=160)
uname = Label(win , text = "Username" , font = 'Perpetua 25 bold', bg="#fff")
uname.place(x=755 , y=300)
pswrd = Label(win , text = "Password" , font = 'Perpetua 25 bold', bg="#fff")
pswrd.place(x=755 , y=350)
h3 = Label(win , text = "Dont't have an Account?" , font = 'Perpetua 25 bold', bg="#fff")
h3.place(x=800 , y=550)
username = StringVar()
password = StringVar()
uentry = Entry(win, font = 'Perpetua 25 bold', bg="#fff", textvariable=username)
uentry.place(x=920, y=300)
pentry = Entry(win, font = 'Perpetua 25 bold', bg="#fff", textvariable=password)
pentry.place(x=920, y=350)
b1 = Button(win, text="Clear", width=7, font='Carrier 15', command=clear)
b1.place(x=920,y=410)
b2 = Button(win, text="Login", width=7, font='Carrier 15', command=login)
b2.place(x=1135,y=410)
b3 = Button(win, text="Signup", width=7, font='Carrier 15', command=signup)
b3.place(x=920,y=620)
win.mainloop()
Вот страница регистрации
from tkinter import *
from tkinter import messagebox
from tkinter.messagebox import showinfo
from tkinter import ttk
import mysql.connector
win2=Tk()
win2.title("AirWaves")
win2.geometry('1366x768')
win2.geometry("+100+50")
win2.configure(bg="#fff")
win2.resizable(False, False)
def clear():
fname.delete(0, END)
lname.delete(0, END)
dob.delete(0, END)
pportno.delete(0, END)
phone.delete(0, END)
email.delete(0, END)
username.delete(0, END)
password.delete(0, END)
veripass.delete(0, END)
def login():
win2.destroy()
import login
def signup():
fn = fname.get()
ln = lname.get()
gen = gender.get()
age = dob.get()
ppno = pportno.get()
em = email.get()
phn = phone.get()
uname= username.get()
passwrd = password.get()
vp = veripass.get()
finalpass = ''
if (vp in passwrd):
finalpass = vp
else:
messagebox.showerror('Error', 'Password does Not Match')
tu = (fn, ln, gen, age, ppno, em, phn, uname, finalpass)
conn = mysql.connector.connect(host='localhost', user='root', password='1074', database='jagran')
cur = conn.cursor()
query = "insert into passengers values(%s, %s , %s, %s , %s , %s , %s, %s, %s)"
cur.execute(query, tu)
conn.commit()
messagebox.showinfo('SignUp Success', 'Account Created')
img = PhotoImage(file="signupplane.png", master=win2)
Label(win2, image=img, bg='white', anchor="nw").place(x=420, y=575)
h1 = Label(win2, text ="AirWaves", font ='Perpetua 35 bold', bg="#fff")
h1.place(x=575 , y=5)
h2 = Label(win2, text ="Airline Reservation System", font ='Perpetua 20 bold', bg="#fff")
h2.place(x=530 , y=50)
#Label names
fname = Label(win2, text ="First Name", font ='Perpetua 25 bold', bg="#fff")
fname.place(x=50 , y=140)
lname = Label(win2, text ="Last Name", font ='Perpetua 25 bold', bg="#fff")
lname.place(x=50 , y=220)
gender = Label(win2, text ="Gender", font ='Perpetua 25 bold', bg="#fff")
gender.place(x=50 , y=300)
dob = Label(win2, text ="D.O.B", font ='Perpetua 25 bold', bg="#fff")
dob.place(x=50 , y=380)
pportno = Label(win2, text ="Passport No.", font ='Perpetua 25 bold', bg="#fff")
pportno.place(x=50 , y=460)
phone = Label(win2, text ="Phone", font ='Perpetua 25 bold', bg="#fff")
phone.place(x=780 , y=140)
email = Label(win2, text ="Email", font ='Perpetua 25 bold', bg="#fff")
email.place(x=780 , y=220)
username = Label(win2, text ="Username", font ='Perpetua 25 bold', bg="#fff")
username.place(x=780 , y=300)
password = Label(win2, text ="Password", font ='Perpetua 25 bold', bg="#fff")
password.place(x=780 , y=380)
veripass = Label(win2, text ="Verify Password", font ='Perpetua 25 bold', bg="#fff")
veripass.place(x=780 , y=460)
fname = StringVar()
lname = StringVar()
gender = StringVar()
dob = StringVar()
pportno = StringVar()
phone = StringVar()
email = StringVar()
username = StringVar()
password = StringVar()
#Label name entry
fname = Entry(win2, font ='Perpetua 20 bold', bg="#fff", textvariable=fname)
fname.place(x=250, y=140)
lname = Entry(win2, font ='Perpetua 20 bold', bg="#fff", textvariable=lname)
lname.place(x=250, y=220)
'''gender = Entry(win3, font ='Perpetua 20 bold', bg="#fff", textvariable=gender)
gender.place(x=250, y=300)'''
s=ttk.Style()
s.configure('bg.TRadiobutton', background="#fff", font ='Perpetua 20 bold')
genderm = ttk.Radiobutton(win2, text='Male', value="Male", variable=gender, style='bg.TRadiobutton')
genderm.place(x= 250 , y= 280)
genderf = ttk.Radiobutton(win2, text='Female', value="Female", variable=gender, style='bg.TRadiobutton')
genderf.place(x= 250 , y= 330)
dob = Entry(win2, font ='Perpetua 20 bold', bg="#fff", textvariable=dob)
dob.place(x=250, y=380)
pportno = Entry(win2, font ='Perpetua 20 bold', bg="#fff", textvariable=pportno)
pportno.place(x=250, y=460)
phone = Entry(win2, font ='Perpetua 20 bold', bg="#fff", textvariable=phone)
phone.place(x=1050, y=140)
email = Entry(win2, font ='Perpetua 20 bold', bg="#fff", textvariable=email)
email.place(x=1050, y=220)
username = Entry(win2, font ='Perpetua 20 bold', bg="#fff", textvariable=username)
username.place(x=1050, y=300)
password = Entry(win2, font ='Perpetua 20 bold', bg="#fff", textvariable=password)
password.place(x=1050, y=380)
veripass = Entry(win2, font ='Perpetua 20 bold', bg="#fff", textvariable=veripass)
veripass.place(x=1050, y=460)
#buttons
b1 = Button(win2, text="Clear", width=10, font='Carrier 15', command=clear)
b1.place(x=410,y=525)
b2 = Button(win2, text="Signup", width=10, font='Carrier 15', command=signup)
b2.place(x=600,y=525)
b3 = Button(win2, text="Back to Login", width=13, font='Carrier 15', command=login)
b3.place(x=790,y=525)
win2.mainloop()
Подробнее здесь: https://stackoverflow.com/questions/791 ... ing-button
Мобильная версия