import tkinter as tk
from tkinter.ttk import *
from tkinter import messagebox
def win2():
nextw=tk.Toplevel()
nextw.title('Tờ khai y tế')
nextw.geometry('700x500')
nextw.configure(background='white' )
labl=Label(nextw,text='Năm sinh(*)',background='white',foreground='black')
labl.place(x=30,y=20)
e1=Entry(nextw,width=25)
e1.place(x=30,y=40)
labl3=Label(nextw,text='Quốc tịch',background='white',foreground='black')
labl3.place(x=500,y=20)
qt=Combobox(nextw)
qt['value']= [ 'Việt Nam', 'Anh', 'Hoa Kỳ','Nhật Bản','Trung Quốc']
qt.current(0)
qt.place (x=500,y=40)
labl4=Label(nextw,text='Địa chỉ liên lạc tại Việt Nam',background='white',foreground='black')
labl4.place(x=30,y=70)
labl5=Label(nextw,text='Tỉnh thành',background='white',foreground='black')
labl5.place(x=30,y=90)
tt=Combobox(nextw)
tt['value']= [ "Hà Nội","Thành phố Hồ Chí Minh",'Đà Nẵng','Huế']
tt.current(0)
tt.place (x=30,y=110)
labl6=Label(nextw,text='Quận huyện',background='white',foreground='black')
labl6.place(x=500,y=90)
e2=Entry(nextw,width=25)
e2.place(x=500,y=110)
labl7=Label(nextw,text='Số nhà, phố, tổ dân phố/thôn/đội',background='white',foreground='black')
labl7.place(x=30,y=150)
e3=Entry(nextw,width=25)
e3.place(x=30,y=170)
labl8=Label(nextw,text='Phường xã',background='white',foreground='black')
labl8.place(x=500,y=150)
e4=Entry(nextw,width=25)
e4.place(x=500,y=170)
labl7=Label(nextw,text='Số điện thoại',background='white',foreground='black')
labl7.place(x=30,y=200)
e5=Entry(nextw,width=25)
e5.place(x=30,y=230)
labl8=Label(nextw,text='Email',background='white',foreground='black')
labl8.place(x=500,y=200)
e6=Entry(nextw,width=25)
e6.place(x=500,y=230)
def thongbao():
w1 = tk.Toplevel()
lbltb = Label(w1, text="Bạn đã khai báo thành công, khai báo tiếp chứ?")
lbltb.pack()
bt = Button(w1, text="Thoát", command=w1.destroy)
bt.pack()
bt1 = Button(w1, text='Đồng ý', command=win2)
bt1.pack()
def display_data():
data = {
"Họ và tên": box1.get(),
"Ngày sinh": box2.get(),
"Giới Tính": selected.get(),
"Quốc tịch": var.get(),
"Nơi khởi hành": box5.get(),
"Nơi đến": box6.get(),
}
win2 = tk.Toplevel()
win2.title('Form khai báo 2')
win2.geometry('1000x600')
# Hiển thị dữ liệu trong cửa sổ mới
for i, (key, value) in enumerate(data.items()):
label = Label(win2, text=f"{key}: {value}")
label.place(x=0, y=25 + i * 25)
# Tạo cửa sổ chính
win = tk.Tk()
win.title('Form khai báo')
win.geometry('500x600')
lbl = Label(win, text="\t Tờ khai y tế", font=('times', 32, 'bold'))
lbl.grid(columnspan=6, ipadx=50)
lbl1 = Label(win, text="Họ và tên: ", font=('times', 12))
lbl1.grid(column=1, row=1)
box1 = Entry(win)
box1.grid(column=2, row=1, ipadx=20)
lbl2 = Label(win, text="Ngày sinh: ", font=('times', 12))
lbl2.grid(column=1, row=2)
box2 = Entry(win)
box2.grid(column=2, row=2)
lbl3 = Label(win, text="Giới Tính: ", font=('times', 12))
lbl3.grid(column=1, row=3)
selected = tk.StringVar()
rad1 = Radiobutton(win, text='Nam', value='Nam', variable=selected)
rad1.place(x=158, y=120)
rad2 = Radiobutton(win, text='Nữ', value='Nữ', variable=selected)
rad2.place(x=158, y=150)
rad3 = Radiobutton(win, text='Khác', value='Khác', variable=selected)
rad3.place(x=158, y=180)
lbl4 = Label(win, text="Quốc tịch: ", font=('times', 12))
lbl4.grid(column=5, row=1)
var = tk.StringVar()
country_list = ['Japan', 'China', 'America', 'Korea', 'Mexico', 'England', 'French', 'Russia', 'Việt Nam', 'Laos', 'Cambodia']
droplist = OptionMenu(win, var, *country_list)
var.set('Vô gia cư')
droplist.config(width=15)
droplist.grid(column=6, row=1)
lbl5 = Label(win, text="Nơi khởi hành: ", font=('times', 12))
lbl5.grid(column=5, row=2)
box5 = Entry(win)
box5.grid(column=6, row=2)
lbl6 = Label(win, text="Nơi đến: ", font=('times', 12))
lbl6.grid(column=5, row=3)
box6 = Entry(win)
box6.grid(column=6, row=3)
lbl7 = Label(win, text="Bạn cam kết lời khai của mình là thật chứ: ", font=('times', 12))
lbl7.grid(column=5, columnspan=2, row=4)
btn2 = tk.Button(win, text='Quay lại', font=('times', 12), width=30, height=3, command=win.destroy)
btn2.place(x=90, y=300)
btn1 = Button(win, text='Submit', command=thongbao)
btn1.place(x=450, y=300)
# Tạo nút để hiển thị dữ liệu
display_button = Button(win, text="Hiển thị Dữ liệu", command=display_data)
display_button.place(x=300, y=375)
win.mainloop()
Sao mà xịn thế 👌👌
Đăng nhập để tham gia bình luận
Ghê ♥️♥️
Đăng nhập để tham gia bình luận
💎💎 quá sáng tạo
Đăng nhập để tham gia bình luận
Quá trời quá đất xịn rồi 🌞
Đăng nhập để tham gia bình luận
🌹cute za
Đăng nhập để tham gia bình luận
Đăng nhập để tham gia bình luận